From 0f08a7007dd9e0635df5732a83f9fbe74d491e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82=D0=B8?= =?UTF-8?q?=D0=BD=20=D0=A3=D0=BA=D0=BE=D0=BB=D0=BE=D0=B2?= <“ukolov.konst@gmail.com”> Date: Wed, 31 Jul 2024 10:33:45 +0300 Subject: [PATCH] build: add orval config --- cakes.json | 624 ++++++++++++++++++++++++++++++++++++++++++++++++ orval.config.ts | 14 ++ 2 files changed, 638 insertions(+) create mode 100644 cakes.json create mode 100644 orval.config.ts diff --git a/cakes.json b/cakes.json new file mode 100644 index 0000000..2a09c30 --- /dev/null +++ b/cakes.json @@ -0,0 +1,624 @@ +{ + "swagger": "2.0", + "info": { + "title": "main.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "CRM" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/cart": { + "post": { + "operationId": "CRM_GetCart", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/crmCartRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "items", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmOrderItem" + } + } + } + ], + "tags": [ + "CRM" + ] + } + }, + "/catalog": { + "get": { + "operationId": "CRM_GetCatalog", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/crmCatalogRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "CRM" + ] + } + }, + "/images/{name}": { + "get": { + "operationId": "CRM_GetImage", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/apiHttpBody" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "CRM" + ] + } + }, + "/orders": { + "post": { + "operationId": "CRM_Order", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/crmOrderRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "order", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/crabscrmOrder" + } + } + ], + "tags": [ + "CRM" + ] + } + }, + "/positions/{id}": { + "get": { + "operationId": "CRM_GetPositions", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/crmPositionsRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "CRM" + ] + } + }, + "/products/{id}": { + "get": { + "operationId": "CRM_GetProduct", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/crmProductRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "CRM" + ] + } + }, + "/products/{id}/breadcrumbs": { + "get": { + "operationId": "CRM_GetBreadcrumbs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/crmBreadcrumbsRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "CRM" + ] + } + }, + "/search": { + "get": { + "operationId": "CRM_Search", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/crmPositionsRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "text", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "CRM" + ] + } + } + }, + "definitions": { + "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." + }, + "crabscrmLabel": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + } + }, + "crabscrmOrder": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmOrderItem" + } + } + } + }, + "crmBreadcrumbsRsp": { + "type": "object", + "properties": { + "categories": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmCategory" + } + } + } + }, + "crmCartItem": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "int64" + }, + "article": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "string" + } + }, + "unit": { + "type": "string" + }, + "inventory": { + "type": "number", + "format": "double" + }, + "count": { + "type": "string", + "format": "int64" + }, + "amount": { + "type": "string", + "format": "int64" + }, + "amountOld": { + "type": "string", + "format": "int64" + }, + "variants": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmVariant" + } + }, + "labels": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crabscrmLabel" + } + } + } + }, + "crmCartRsp": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmCartItem" + } + }, + "amount": { + "type": "string", + "format": "int64" + }, + "amountOld": { + "type": "string", + "format": "int64" + } + } + }, + "crmCatalogRsp": { + "type": "object", + "properties": { + "categories": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmCategory" + } + } + } + }, + "crmCategory": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "int64" + }, + "name": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "children": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmCategory" + } + } + } + }, + "crmCharacteristic": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "crmGroupedProduct": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "image": { + "type": "string" + } + } + }, + "crmOrderItem": { + "type": "object", + "properties": { + "productId": { + "type": "string", + "format": "int64" + }, + "count": { + "type": "string", + "format": "int64" + } + } + }, + "crmOrderRsp": { + "type": "object" + }, + "crmPositionsRsp": { + "type": "object", + "properties": { + "products": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmProduct" + } + } + } + }, + "crmProduct": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "int64" + }, + "article": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "groupedProducts": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmGroupedProduct" + } + }, + "unit": { + "type": "string" + }, + "inventory": { + "type": "number", + "format": "double" + }, + "variants": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmVariant" + } + }, + "characteristics": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmCharacteristic" + } + }, + "category": { + "type": "string", + "format": "int64" + }, + "labels": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crabscrmLabel" + } + } + } + }, + "crmProductRsp": { + "type": "object", + "properties": { + "product": { + "$ref": "#/definitions/crmProduct" + } + } + }, + "crmProperty": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "crmVariant": { + "type": "object", + "properties": { + "price": { + "type": "string", + "format": "int64" + }, + "properties": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/crmProperty" + } + }, + "active": { + "type": "boolean" + } + } + }, + "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. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\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 // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 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\n Example 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\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" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/orval.config.ts b/orval.config.ts new file mode 100644 index 0000000..b520868 --- /dev/null +++ b/orval.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from 'orval' + +export default defineConfig({ + cakes: { + output: { + mode: 'tags-split', + target: 'src/cakes.ts', + schemas: 'src/shared/model', + client: 'vue-query', + mock: true, + }, + input: './cakes.json', + }, +})