aboutsummaryrefslogtreecommitdiff
path: root/cmd/twirp-openapi-gen/internal/generator/testdata/doc.json
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-02-24 14:48:23 -0500
committerXe Iaso <me@xeiaso.net>2024-02-24 14:50:50 -0500
commitb27ea6b8587f6735a309e47e1abcf3acd12f7953 (patch)
tree1c943a6a73fc1e7fbbaaa50852881f4d35252882 /cmd/twirp-openapi-gen/internal/generator/testdata/doc.json
parent4bca52442d62a5dee3d8b533b48df0223e1679b0 (diff)
downloadxesite-b27ea6b8587f6735a309e47e1abcf3acd12f7953.tar.xz
xesite-b27ea6b8587f6735a309e47e1abcf3acd12f7953.zip
cmd: import twirp-openapi-gen, fix some bugs
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd/twirp-openapi-gen/internal/generator/testdata/doc.json')
-rw-r--r--cmd/twirp-openapi-gen/internal/generator/testdata/doc.json405
1 files changed, 405 insertions, 0 deletions
diff --git a/cmd/twirp-openapi-gen/internal/generator/testdata/doc.json b/cmd/twirp-openapi-gen/internal/generator/testdata/doc.json
new file mode 100644
index 0000000..afe6c6d
--- /dev/null
+++ b/cmd/twirp-openapi-gen/internal/generator/testdata/doc.json
@@ -0,0 +1,405 @@
+{
+ "components": {
+ "schemas": {
+ "google.protobuf.Any": {
+ "description": "\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\tpackage google.profile;\n\tmessage Person {\n\t string first_name = 1;\n\t string last_name = 2;\n\t}\n\n\t{\n\t \"@type\": \"type.googleapis.com/google.profile.Person\",\n\t \"firstName\": \u003cstring\u003e,\n\t \"lastName\": \u003cstring\u003e\n\t}\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\nvalue which holds the custom JSON in addition to the @type\nfield. Example (for message [google.protobuf.Duration][]):\n\n\t{\n\t \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n\t \"value\": \"1.212s\"\n\t}\n",
+ "properties": {
+ "@type": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "google.protobuf.ListValue": {
+ "description": "\nListValue is a wrapper around a repeated field of values.\nThe JSON representation for ListValue is JSON array.\n",
+ "items": {
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "integer"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "array"
+ },
+ {
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ "google.protobuf.Struct": {
+ "description": "\nStruct represents a structured data value, consisting of fields\nwhich map to dynamically typed values. In some languages, \nStruct might be supported by a native representation. For example,\nin scripting languages like JS a struct is represented as\nan object. The details of that representation are described\ntogether with the proto support for the language.\n\nThe JSON representation for Struct is JSON object.\n",
+ "properties": {
+ "fields": {
+ "additionalProperties": {
+ "$ref": "#/components/schemas/google.protobuf.Value"
+ },
+ "description": "Unordered map of dynamically typed values.",
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "google.protobuf.Value": {
+ "description": "\nValue represents a dynamically typed value which can be either\nnull, a number, a string, a boolean, a recursive struct value, or a\nlist of values. A producer of value is expected to set one of that\nvariants, absence of any variant indicates an error.\n\t\t\t\t\nThe JSON representation for Value is JSON value.\n",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "integer"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "$ref": "#/components/schemas/google.protobuf.Struct"
+ },
+ {
+ "$ref": "#/components/schemas/google.protobuf.ListValue"
+ }
+ ]
+ },
+ "google.type.Money": {
+ "description": "Represents an amount of money with its currency type",
+ "properties": {
+ "currency_code": {
+ "description": "The 3-letter currency code defined in ISO 4217.",
+ "type": "string"
+ },
+ "nanos": {
+ "description": "Number of nano (10^-9) units of the amount.\nThe value must be between -999,999,999 and +999,999,999 inclusive.\nIf `units` is positive, `nanos` must be positive or zero.\nIf `units` is zero, `nanos` can be positive, zero, or negative.\nIf `units` is negative, `nanos` must be negative or zero.\nFor example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.",
+ "format": "int32",
+ "type": "integer"
+ },
+ "units": {
+ "description": "The whole units of the amount.\nFor example if `currencyCode` is `\"USD\"`, then 1 unit is one US dollar.",
+ "format": "int64",
+ "type": "integer"
+ }
+ },
+ "type": "object"
+ },
+ "payment.v1alpha1.Order": {
+ "description": "Order represents a monetary order.",
+ "properties": {
+ "amount": {
+ "$ref": "#/components/schemas/google.type.Money"
+ },
+ "order_id": {
+ "type": "string"
+ },
+ "payment_provider": {
+ "$ref": "#/components/schemas/payment.v1alpha1.PaymentProvider"
+ },
+ "recipient_id": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "payment.v1alpha1.PaymentProvider": {
+ "description": "PaymentProvider represents the supported set\nof payment providers.",
+ "enum": [
+ "PAYMENT_PROVIDER_UNSPECIFIED",
+ "PAYMENT_PROVIDER_STRIPE",
+ "PAYMENT_PROVIDER_PAYPAL",
+ "PAYMENT_PROVIDER_APPLE"
+ ],
+ "type": "string"
+ },
+ "pet.v1.DeletePetRequest": {
+ "properties": {
+ "pet_id": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.GetPetRequest": {
+ "description": "GetPetRequest is the request object for GetPet\nThe message accepts a pet id as an input",
+ "properties": {
+ "pet_id": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.GetPetResponse": {
+ "properties": {
+ "pet": {
+ "$ref": "#/components/schemas/pet.v1.Pet"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.Pet": {
+ "description": "Pet represents a pet in the pet store.",
+ "properties": {
+ "created_at": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "details": {
+ "items": {
+ "$ref": "#/components/schemas/google.protobuf.Any"
+ },
+ "type": "array"
+ },
+ "labels": {
+ "$ref": "#/components/schemas/google.protobuf.ListValue"
+ },
+ "metadata": {
+ "$ref": "#/components/schemas/google.protobuf.Struct"
+ },
+ "name": {
+ "type": "string"
+ },
+ "payment_provider": {
+ "$ref": "#/components/schemas/payment.v1alpha1.PaymentProvider"
+ },
+ "pet_id": {
+ "description": "pet_id is an auto-generated id for the pet\nthe id uniquely identifies a pet in the system",
+ "type": "string"
+ },
+ "pet_type": {
+ "$ref": "#/components/schemas/pet.v1.PetType"
+ },
+ "pet_types": {
+ "items": {
+ "$ref": "#/components/schemas/pet.v1.PetType"
+ },
+ "type": "array"
+ },
+ "tags": {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "vet": {
+ "$ref": "#/components/schemas/pet.v1.Vet"
+ },
+ "vets": {
+ "items": {
+ "$ref": "#/components/schemas/pet.v1.Vet"
+ },
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.PetType": {
+ "description": "PetType represents the different types of pets in the pet store.",
+ "enum": [
+ "PET_TYPE_UNSPECIFIED",
+ "PET_TYPE_CAT",
+ "PET_TYPE_DOG",
+ "PET_TYPE_SNAKE",
+ "PET_TYPE_HAMSTER"
+ ],
+ "type": "string"
+ },
+ "pet.v1.PurchasePetRequest": {
+ "properties": {
+ "order": {
+ "$ref": "#/components/schemas/payment.v1alpha1.Order"
+ },
+ "pet_id": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.PurchasePetResponse": {
+ "type": "object"
+ },
+ "pet.v1.PutPetRequest": {
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "pet_type": {
+ "$ref": "#/components/schemas/pet.v1.PetType"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.PutPetResponse": {
+ "properties": {
+ "pet": {
+ "$ref": "#/components/schemas/pet.v1.Pet"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.UpdatePetRequest": {
+ "properties": {
+ "metadata": {
+ "$ref": "#/components/schemas/google.protobuf.Struct"
+ },
+ "pet_id": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.UpdatePetResponse": {
+ "properties": {
+ "pet": {
+ "$ref": "#/components/schemas/pet.v1.Pet"
+ }
+ },
+ "type": "object"
+ },
+ "pet.v1.Vet": {
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ },
+ "info": {
+ "title": "Test",
+ "version": "0.1"
+ },
+ "openapi": "3.0.0",
+ "paths": {
+ "/pet.v1.PetStoreService/DeletePet": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet.v1.DeletePetRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {}
+ },
+ "description": "Success"
+ }
+ },
+ "summary": "DeletePet"
+ }
+ },
+ "/pet.v1.PetStoreService/GetPet": {
+ "post": {
+ "description": "\nGetPet returns details about a pet\nIt accepts a pet id as an input and returns back the matching pet object",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "example": {
+ "example 0": {
+ "pet_id": "123"
+ },
+ "example 1": {
+ "pet_id": "456"
+ }
+ },
+ "schema": {
+ "$ref": "#/components/schemas/pet.v1.GetPetRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "example": {
+ "example 0": {
+ "pet": {
+ "name": "toby"
+ }
+ }
+ },
+ "schema": {
+ "$ref": "#/components/schemas/pet.v1.GetPetResponse"
+ }
+ }
+ },
+ "description": "Success"
+ }
+ },
+ "summary": "GetPet"
+ }
+ },
+ "/pet.v1.PetStoreService/PurchasePet": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet.v1.PurchasePetRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet.v1.PurchasePetResponse"
+ }
+ }
+ },
+ "description": "Success"
+ }
+ },
+ "summary": "PurchasePet"
+ }
+ },
+ "/pet.v1.PetStoreService/UpdatePet": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet.v1.UpdatePetRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet.v1.UpdatePetResponse"
+ }
+ }
+ },
+ "description": "Success"
+ }
+ },
+ "summary": "UpdatePet"
+ }
+ }
+ },
+ "servers": [
+ {
+ "url": "https://example.com"
+ }
+ ]
+} \ No newline at end of file