{ "swagger": "2.0", "info": { "title": "examples/internal/proto/examplepb/stream.proto", "version": "version not set" }, "tags": [ { "name": "StreamService" } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/example/a_bit_of_everything": { "get": { "operationId": "StreamService_List", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/examplepbABitOfEverything" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of examplepbABitOfEverything" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "error", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "StreamService" ] } }, "/v1/example/a_bit_of_everything/bulk": { "post": { "operationId": "StreamService_BulkCreate", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": "Intentionally complicated message type to cover many features of Protobuf. (streaming inputs)", "in": "body", "required": true, "schema": { "$ref": "#/definitions/examplepbABitOfEverything" } } ], "tags": [ "StreamService" ] } }, "/v1/example/a_bit_of_everything/echo": { "post": { "operationId": "StreamService_BulkEcho", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/subStringMessage" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of subStringMessage" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": " (streaming inputs)", "in": "body", "required": true, "schema": { "$ref": "#/definitions/subStringMessage" } } ], "tags": [ "StreamService" ] } }, "/v1/example/download": { "get": { "operationId": "StreamService_Download", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "string", "format": "binary", "properties": {}, "title": "Free form byte stream" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "error", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "StreamService" ] } } }, "definitions": { "ABitOfEverythingNested": { "type": "object", "example": { "ok": "TRUE" }, "properties": { "name": { "type": "string", "description": "name is nested field." }, "amount": { "type": "integer", "format": "int64" }, "ok": { "$ref": "#/definitions/NestedDeepEnum", "description": "DeepEnum description." } }, "description": "Nested is nested type." }, "MessagePathEnumNestedPathEnum": { "type": "string", "enum": [ "GHI", "JKL" ], "default": "GHI" }, "NestedDeepEnum": { "type": "string", "enum": [ "FALSE", "TRUE" ], "default": "FALSE", "description": "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true." }, "apiHttpBody": { "type": "object", "properties": { "contentType": { "type": "string", "description": "The HTTP Content-Type header value specifying the content type of the body." }, "data": { "type": "string", "format": "byte", "description": "The HTTP request/response body as raw binary." }, "extensions": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "Application specific response metadata. Must be set in the first response\nfor streaming APIs." } }, "description": "Message that represents an arbitrary HTTP body. It should only be used for\npayload formats that can't be represented as JSON, such as raw binary or\nan HTML page.\n\n\nThis message can be used both in streaming and non-streaming API methods in\nthe request as well as the response.\n\nIt can be used as a top-level request field, which is convenient if one\nwants to extract parameters from either the URL or HTTP template into the\nrequest fields and also want access to the raw HTTP body.\n\nExample:\n\n message GetResourceRequest {\n // A unique request id.\n string request_id = 1;\n\n // The raw HTTP body is bound to this field.\n google.api.HttpBody http_body = 2;\n\n }\n\n service ResourceService {\n rpc GetResource(GetResourceRequest)\n returns (google.api.HttpBody);\n rpc UpdateResource(google.api.HttpBody)\n returns (google.protobuf.Empty);\n\n }\n\nExample with streaming methods:\n\n service CaldavService {\n rpc GetCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n rpc UpdateCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n\n }\n\nUse of this type only changes how the request and response bodies are\nhandled, all other features will continue to work unchanged." }, "examplepbABitOfEverything": { "type": "object", "example": { "int64_value": 12, "double_value": 12.3 }, "properties": { "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "uuid": { "type": "string", "format": "uuid", "minLength": 1, "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "x-internal": true }, "nested": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" } }, "floatValue": { "type": "number", "format": "float", "default": "0.2", "description": "Float value field" }, "doubleValue": { "type": "number", "format": "double" }, "int64Value": { "type": "string", "format": "int64" }, "uint64Value": { "type": "string", "format": "uint64" }, "int32Value": { "type": "integer", "format": "int32" }, "fixed64Value": { "type": "string", "format": "uint64" }, "fixed32Value": { "type": "integer", "format": "int64" }, "boolValue": { "type": "boolean" }, "stringValue": { "type": "string" }, "bytesValue": { "type": "string", "format": "byte" }, "uint32Value": { "type": "integer", "format": "int64" }, "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, "pathEnumValue": { "$ref": "#/definitions/pathenumPathEnum" }, "nestedPathEnumValue": { "$ref": "#/definitions/MessagePathEnumNestedPathEnum" }, "sfixed32Value": { "type": "integer", "format": "int32" }, "sfixed64Value": { "type": "string", "format": "int64" }, "sint32Value": { "type": "integer", "format": "int32" }, "sint64Value": { "type": "string", "format": "int64" }, "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, "oneofEmpty": { "type": "object", "properties": {} }, "oneofString": { "type": "string" }, "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" } }, "nonConventionalNameValue": { "type": "string" }, "timestampValue": { "type": "string", "format": "date-time" }, "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "title": "repeated enum value. it is comma-separated in query" }, "repeatedEnumAnnotation": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" }, "description": "Repeated numeric enum description.", "title": "Repeated numeric enum title" }, "enumValueAnnotation": { "$ref": "#/definitions/examplepbNumericEnum", "description": "Numeric enum description.", "title": "Numeric enum title" }, "repeatedStringAnnotation": { "type": "array", "items": { "type": "string" }, "description": "Repeated string description.", "title": "Repeated string title" }, "repeatedNestedAnnotation": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/ABitOfEverythingNested" }, "description": "Repeated nested object description.", "title": "Repeated nested object title" }, "nestedAnnotation": { "$ref": "#/definitions/ABitOfEverythingNested", "description": "Nested object description.", "title": "Nested object title" }, "int64OverrideType": { "type": "integer", "format": "int64" }, "requiredStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as required in Open API definition" }, "outputOnlyStringViaFieldBehaviorAnnotation": { "type": "string", "title": "mark a field as readonly in Open API definition", "readOnly": true }, "optionalStringValue": { "type": "string" }, "productId": { "type": "array", "items": { "type": "string", "maxLength": 19, "minLength": 1, "pattern": "^[0-9]+$" }, "description": "Only digits are allowed.", "title": "Test openapiv2 generation of repeated fields" }, "optionalStringField": { "type": "string", "title": "Test openapiv2 generation of required fields with annotation and jsonschema to reproduce" }, "requiredStringField1": { "type": "string" }, "requiredStringField2": { "type": "string" }, "required_field_behavior_json_name_custom": { "type": "string", "title": "Test openapiv2 handling of required json_name fields" }, "required_field_schema_json_name_custom": { "type": "string" }, "trailingOnly": { "type": "string", "title": "Trailing only" }, "trailingOnlyDot": { "type": "string", "description": "Trailing only dot." }, "trailingBoth": { "type": "string", "description": "Trailing both.", "title": "Leading both" }, "trailingMultiline": { "type": "string", "description": "This is an example of a multi-line comment.\n\nTrailing multiline.", "title": "Leading multiline" }, "uuids": { "type": "array", "items": { "type": "string", "format": "uuid" }, "title": "Specify a custom format of repeated field items" } }, "description": "Intentionally complicated message type to cover many features of Protobuf.", "title": "A bit of everything", "externalDocs": { "description": "Find out more about ABitOfEverything", "url": "https://github.com/grpc-ecosystem/grpc-gateway" }, "required": [ "uuid", "int64Value", "doubleValue", "required_field_schema_json_name_custom", "floatValue", "requiredStringViaFieldBehaviorAnnotation", "requiredStringField1", "requiredStringField2", "required_field_behavior_json_name_custom" ], "x-a-bit-of-everything-foo": "bar" }, "examplepbNumericEnum": { "type": "string", "enum": [ "ZERO", "ONE" ], "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, "pathenumPathEnum": { "type": "string", "enum": [ "ABC", "DEF" ], "default": "ABC" }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." } }, "additionalProperties": {}, "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32", "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." }, "message": { "type": "string", "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" }, "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." } }, "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." }, "subStringMessage": { "type": "object", "properties": { "value": { "type": "string" } } } } }