@hey-api/openapi-ts 0.53.5 → 0.53.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +56 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2092 -6
- package/dist/index.d.ts +2092 -6
- package/dist/index.js +53 -53
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -109,7 +109,7 @@ type MediaType = 'application/json';
|
|
|
109
109
|
* to resolve the issue reported
|
|
110
110
|
* {@link https://github.com/hey-api/openapi-ts/issues/612}
|
|
111
111
|
*/
|
|
112
|
-
interface MediaTypeObject {
|
|
112
|
+
interface MediaTypeObject$1 {
|
|
113
113
|
example?: unknown;
|
|
114
114
|
examples?: Dictionary<OpenApiExample>;
|
|
115
115
|
schema: OpenApiSchema$1;
|
|
@@ -120,7 +120,7 @@ interface MediaTypeObject {
|
|
|
120
120
|
interface OpenApiParameter extends OpenApiReference$1 {
|
|
121
121
|
allowEmptyValue?: boolean;
|
|
122
122
|
allowReserved?: boolean;
|
|
123
|
-
content?: Record<MediaType, MediaTypeObject>;
|
|
123
|
+
content?: Record<MediaType, MediaTypeObject$1>;
|
|
124
124
|
deprecated?: boolean;
|
|
125
125
|
description?: string;
|
|
126
126
|
example?: unknown;
|
|
@@ -443,6 +443,8 @@ interface PluginConfig$3 extends PluginDefinition {
|
|
|
443
443
|
*/
|
|
444
444
|
queryOptions?: boolean;
|
|
445
445
|
}
|
|
446
|
+
interface UserConfig$4 extends Pick<PluginConfig$3, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
|
|
447
|
+
}
|
|
446
448
|
|
|
447
449
|
interface PluginConfig$2 extends PluginDefinition {
|
|
448
450
|
/**
|
|
@@ -471,6 +473,8 @@ interface PluginConfig$2 extends PluginDefinition {
|
|
|
471
473
|
*/
|
|
472
474
|
queryOptions?: boolean;
|
|
473
475
|
}
|
|
476
|
+
interface UserConfig$3 extends Pick<PluginConfig$2, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
|
|
477
|
+
}
|
|
474
478
|
|
|
475
479
|
interface PluginConfig$1 extends PluginDefinition {
|
|
476
480
|
/**
|
|
@@ -499,6 +503,8 @@ interface PluginConfig$1 extends PluginDefinition {
|
|
|
499
503
|
*/
|
|
500
504
|
queryOptions?: boolean;
|
|
501
505
|
}
|
|
506
|
+
interface UserConfig$2 extends Pick<PluginConfig$1, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
|
|
507
|
+
}
|
|
502
508
|
|
|
503
509
|
interface PluginConfig extends PluginDefinition {
|
|
504
510
|
/**
|
|
@@ -527,8 +533,14 @@ interface PluginConfig extends PluginDefinition {
|
|
|
527
533
|
*/
|
|
528
534
|
queryOptions?: boolean;
|
|
529
535
|
}
|
|
536
|
+
interface UserConfig$1 extends Pick<PluginConfig, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
|
|
537
|
+
}
|
|
530
538
|
|
|
531
|
-
|
|
539
|
+
/**
|
|
540
|
+
* User-facing plugin types.
|
|
541
|
+
*/
|
|
542
|
+
type UserPlugins = UserConfig$4 | UserConfig$3 | UserConfig$2 | UserConfig$1;
|
|
543
|
+
type ClientPlugins = PluginConfig$6 | PluginConfig$5 | PluginConfig$4 | PluginConfig$3 | PluginConfig$2 | PluginConfig$1 | PluginConfig;
|
|
532
544
|
|
|
533
545
|
declare const CLIENTS: readonly ["@hey-api/client-axios", "@hey-api/client-fetch", "legacy/angular", "legacy/axios", "legacy/fetch", "legacy/node", "legacy/xhr"];
|
|
534
546
|
type Client = (typeof CLIENTS)[number];
|
|
@@ -613,7 +625,7 @@ interface ClientConfig {
|
|
|
613
625
|
/**
|
|
614
626
|
* Plugins are used to generate additional output files from provided input.
|
|
615
627
|
*/
|
|
616
|
-
plugins?: ReadonlyArray<
|
|
628
|
+
plugins?: ReadonlyArray<UserPlugins['name'] | UserPlugins>;
|
|
617
629
|
/**
|
|
618
630
|
* Path to custom request file
|
|
619
631
|
* @deprecated
|
|
@@ -749,7 +761,7 @@ interface UserConfig extends ClientConfig {
|
|
|
749
761
|
type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'name' | 'output' | 'plugins' | 'request' | 'schemas' | 'services' | 'types'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
|
|
750
762
|
client: Extract<Required<ClientConfig>['client'], object>;
|
|
751
763
|
output: Extract<Required<ClientConfig>['output'], object>;
|
|
752
|
-
plugins: ExtractArrayOfObjects<
|
|
764
|
+
plugins: ExtractArrayOfObjects<ReadonlyArray<ClientPlugins>, {
|
|
753
765
|
name: string;
|
|
754
766
|
}>;
|
|
755
767
|
schemas: Extract<Required<ClientConfig>['schemas'], object>;
|
|
@@ -757,6 +769,2080 @@ type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'name' | 'output'
|
|
|
757
769
|
types: Extract<Required<ClientConfig>['types'], object>;
|
|
758
770
|
};
|
|
759
771
|
|
|
772
|
+
interface OpenApiV3_0_3 {
|
|
773
|
+
/**
|
|
774
|
+
* **REQUIRED**. This string MUST be the {@link https://semver.org/spec/v2.0.0.html semantic version number} of the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#versions OpenAPI Specification version} that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is _not_ related to the API {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoVersion `info.version`} string.
|
|
775
|
+
*/
|
|
776
|
+
openapi: '3.0.3';
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* This is the root object of the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-document OpenAPI document}.
|
|
781
|
+
*
|
|
782
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
783
|
+
*/
|
|
784
|
+
interface OpenApiV3_1 {
|
|
785
|
+
/**
|
|
786
|
+
* An element to hold various schemas for the document.
|
|
787
|
+
*/
|
|
788
|
+
components?: ComponentsObject;
|
|
789
|
+
/**
|
|
790
|
+
* Additional external documentation.
|
|
791
|
+
*/
|
|
792
|
+
externalDocs?: ExternalDocumentationObject;
|
|
793
|
+
/**
|
|
794
|
+
* **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required.
|
|
795
|
+
*/
|
|
796
|
+
info: InfoObject;
|
|
797
|
+
/**
|
|
798
|
+
* The default value for the `$schema` keyword within {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Objects} contained within this OAS document. This MUST be in the form of a URI.
|
|
799
|
+
*/
|
|
800
|
+
jsonSchemaDialect?: string;
|
|
801
|
+
/**
|
|
802
|
+
* **REQUIRED**. This string MUST be the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions version number} of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is _not_ related to the API {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion `info.version`} string.
|
|
803
|
+
*/
|
|
804
|
+
openapi: '3.1.0';
|
|
805
|
+
/**
|
|
806
|
+
* The available paths and operations for the API.
|
|
807
|
+
*/
|
|
808
|
+
paths?: PathsObject;
|
|
809
|
+
/**
|
|
810
|
+
* A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array.
|
|
811
|
+
*/
|
|
812
|
+
security?: ReadonlyArray<SecurityRequirementObject>;
|
|
813
|
+
/**
|
|
814
|
+
* An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object Server Object} with a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverUrl url} value of `/`.
|
|
815
|
+
*/
|
|
816
|
+
servers?: ReadonlyArray<ServerObject>;
|
|
817
|
+
/**
|
|
818
|
+
* A list of tags used by the document with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object} must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.
|
|
819
|
+
*/
|
|
820
|
+
tags?: ReadonlyArray<TagObject>;
|
|
821
|
+
/**
|
|
822
|
+
* The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An {@link https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.1/webhook-example.yaml example} is available.
|
|
823
|
+
*/
|
|
824
|
+
webhooks?: Record<string, PathItemObject | ReferenceObject>;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* A map of possible out-of band callbacks related to the parent operation. Each value in the map is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object} that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
|
|
828
|
+
*
|
|
829
|
+
* To describe incoming requests from the API provider independent from another API call, use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasWebhooks `webhooks`} field.
|
|
830
|
+
*
|
|
831
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
832
|
+
*
|
|
833
|
+
* **Key Expression**
|
|
834
|
+
*
|
|
835
|
+
* The key that identifies the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object} is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#runtime-expressions runtime expression} that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be $request.body#/url. However, using a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#runtime-expressions runtime expression} the complete HTTP message can be accessed. This includes accessing any part of a body that a JSON Pointer {@link https://tools.ietf.org/html/rfc6901 RFC6901} can reference.
|
|
836
|
+
*
|
|
837
|
+
* For example, given the following HTTP request:
|
|
838
|
+
*
|
|
839
|
+
* ```http
|
|
840
|
+
* POST /subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning HTTP/1.1
|
|
841
|
+
* Host: example.org
|
|
842
|
+
* Content-Type: application/json
|
|
843
|
+
* Content-Length: 187
|
|
844
|
+
*
|
|
845
|
+
* {
|
|
846
|
+
* "failedUrl" : "https://clientdomain.com/failed",
|
|
847
|
+
* "successUrls" : [
|
|
848
|
+
* "https://clientdomain.com/fast",
|
|
849
|
+
* "https://clientdomain.com/medium",
|
|
850
|
+
* "https://clientdomain.com/slow"
|
|
851
|
+
* ]
|
|
852
|
+
* }
|
|
853
|
+
*
|
|
854
|
+
* 201 Created
|
|
855
|
+
* Location: https://example.org/subscription/1
|
|
856
|
+
* ```
|
|
857
|
+
*
|
|
858
|
+
* The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`.
|
|
859
|
+
*
|
|
860
|
+
* | Expression | Value |
|
|
861
|
+
* | -------- | ------- |
|
|
862
|
+
* | $url | https://example.org/subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning |
|
|
863
|
+
* | $method | POST |
|
|
864
|
+
* | $request.path.eventType | myevent |
|
|
865
|
+
* | $request.query.queryUrl | https://clientdomain.com/stillrunning |
|
|
866
|
+
* | $request.header.content-Type | application/json |
|
|
867
|
+
* | $request.body#/failedUrl | https://clientdomain.com/failed |
|
|
868
|
+
* | $request.body#/successUrls/2 | https://clientdomain.com/medium |
|
|
869
|
+
* | $response.header.Location | https://example.org/subscription/1 |
|
|
870
|
+
*
|
|
871
|
+
* **Callback Object Examples**
|
|
872
|
+
*
|
|
873
|
+
* The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook.
|
|
874
|
+
*
|
|
875
|
+
* ```yaml
|
|
876
|
+
* myCallback:
|
|
877
|
+
* '{$request.query.queryUrl}':
|
|
878
|
+
* post:
|
|
879
|
+
* requestBody:
|
|
880
|
+
* description: Callback payload
|
|
881
|
+
* content:
|
|
882
|
+
* 'application/json':
|
|
883
|
+
* schema:
|
|
884
|
+
* $ref: '#/components/schemas/SomePayload'
|
|
885
|
+
* responses:
|
|
886
|
+
* '200':
|
|
887
|
+
* description: callback successfully processed
|
|
888
|
+
* ```
|
|
889
|
+
*
|
|
890
|
+
* The following example shows a callback where the server is hard-coded, but the query string parameters are populated from the `id` and `email` property in the request body.
|
|
891
|
+
*
|
|
892
|
+
* ```yaml
|
|
893
|
+
* transactionCallback:
|
|
894
|
+
* 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
|
|
895
|
+
* post:
|
|
896
|
+
* requestBody:
|
|
897
|
+
* description: Callback payload
|
|
898
|
+
* content:
|
|
899
|
+
* 'application/json':
|
|
900
|
+
* schema:
|
|
901
|
+
* $ref: '#/components/schemas/SomePayload'
|
|
902
|
+
* responses:
|
|
903
|
+
* '200':
|
|
904
|
+
* description: callback successfully processed
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
interface CallbackObject {
|
|
908
|
+
/**
|
|
909
|
+
* A Path Item Object, or a reference to one, used to define a callback request and expected responses. A {@link https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/callback-example.yaml complete example} is available.
|
|
910
|
+
*/
|
|
911
|
+
[expression: string]: PathItemObject | ReferenceObject;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
|
|
915
|
+
*
|
|
916
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
917
|
+
*
|
|
918
|
+
* All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`.
|
|
919
|
+
*
|
|
920
|
+
* Field Name Examples:
|
|
921
|
+
*
|
|
922
|
+
* ```
|
|
923
|
+
* User
|
|
924
|
+
* User_1
|
|
925
|
+
* User_Name
|
|
926
|
+
* user-name
|
|
927
|
+
* my.org.User
|
|
928
|
+
* ```
|
|
929
|
+
*
|
|
930
|
+
* **Components Object Example**
|
|
931
|
+
*
|
|
932
|
+
* ```yaml
|
|
933
|
+
* components:
|
|
934
|
+
* schemas:
|
|
935
|
+
* GeneralError:
|
|
936
|
+
* type: object
|
|
937
|
+
* properties:
|
|
938
|
+
* code:
|
|
939
|
+
* type: integer
|
|
940
|
+
* format: int32
|
|
941
|
+
* message:
|
|
942
|
+
* type: string
|
|
943
|
+
* Category:
|
|
944
|
+
* type: object
|
|
945
|
+
* properties:
|
|
946
|
+
* id:
|
|
947
|
+
* type: integer
|
|
948
|
+
* format: int64
|
|
949
|
+
* name:
|
|
950
|
+
* type: string
|
|
951
|
+
* Tag:
|
|
952
|
+
* type: object
|
|
953
|
+
* properties:
|
|
954
|
+
* id:
|
|
955
|
+
* type: integer
|
|
956
|
+
* format: int64
|
|
957
|
+
* name:
|
|
958
|
+
* type: string
|
|
959
|
+
* parameters:
|
|
960
|
+
* skipParam:
|
|
961
|
+
* name: skip
|
|
962
|
+
* in: query
|
|
963
|
+
* description: number of items to skip
|
|
964
|
+
* required: true
|
|
965
|
+
* schema:
|
|
966
|
+
* type: integer
|
|
967
|
+
* format: int32
|
|
968
|
+
* limitParam:
|
|
969
|
+
* name: limit
|
|
970
|
+
* in: query
|
|
971
|
+
* description: max records to return
|
|
972
|
+
* required: true
|
|
973
|
+
* schema:
|
|
974
|
+
* type: integer
|
|
975
|
+
* format: int32
|
|
976
|
+
* responses:
|
|
977
|
+
* NotFound:
|
|
978
|
+
* description: Entity not found.
|
|
979
|
+
* IllegalInput:
|
|
980
|
+
* description: Illegal input for operation.
|
|
981
|
+
* GeneralError:
|
|
982
|
+
* description: General Error
|
|
983
|
+
* content:
|
|
984
|
+
* application/json:
|
|
985
|
+
* schema:
|
|
986
|
+
* $ref: '#/components/schemas/GeneralError'
|
|
987
|
+
* securitySchemes:
|
|
988
|
+
* api_key:
|
|
989
|
+
* type: apiKey
|
|
990
|
+
* name: api_key
|
|
991
|
+
* in: header
|
|
992
|
+
* petstore_auth:
|
|
993
|
+
* type: oauth2
|
|
994
|
+
* flows:
|
|
995
|
+
* implicit:
|
|
996
|
+
* authorizationUrl: https://example.org/api/oauth/dialog
|
|
997
|
+
* scopes:
|
|
998
|
+
* write:pets: modify pets in your account
|
|
999
|
+
* read:pets: read your pets
|
|
1000
|
+
* ```
|
|
1001
|
+
*/
|
|
1002
|
+
interface ComponentsObject {
|
|
1003
|
+
/**
|
|
1004
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}.
|
|
1005
|
+
*/
|
|
1006
|
+
callbacks?: Record<string, CallbackObject | ReferenceObject>;
|
|
1007
|
+
/**
|
|
1008
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object Example Objects}.
|
|
1009
|
+
*/
|
|
1010
|
+
examples?: Record<string, ExampleObject | ReferenceObject>;
|
|
1011
|
+
/**
|
|
1012
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#header-object Header Objects}.
|
|
1013
|
+
*/
|
|
1014
|
+
headers?: Record<string, HeaderObject | ReferenceObject>;
|
|
1015
|
+
/**
|
|
1016
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#link-object Link Objects}.
|
|
1017
|
+
*/
|
|
1018
|
+
links?: Record<string, LinkObject | ReferenceObject>;
|
|
1019
|
+
/**
|
|
1020
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object Parameter Objects}.
|
|
1021
|
+
*/
|
|
1022
|
+
parameters?: Record<string, ParameterObject | ReferenceObject>;
|
|
1023
|
+
/**
|
|
1024
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object}.
|
|
1025
|
+
*/
|
|
1026
|
+
pathItems?: Record<string, PathItemObject | ReferenceObject>;
|
|
1027
|
+
/**
|
|
1028
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object Request Body Objects}.
|
|
1029
|
+
*/
|
|
1030
|
+
requestBodies?: Record<string, RequestBodyObject | ReferenceObject>;
|
|
1031
|
+
/**
|
|
1032
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object Response Objects}.
|
|
1033
|
+
*/
|
|
1034
|
+
responses?: Record<string, ResponseObject | ReferenceObject>;
|
|
1035
|
+
/**
|
|
1036
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Objects}.
|
|
1037
|
+
*/
|
|
1038
|
+
schemas?: Record<string, SchemaObject>;
|
|
1039
|
+
/**
|
|
1040
|
+
* An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object Security Scheme Objects}.
|
|
1041
|
+
*/
|
|
1042
|
+
securitySchemes?: Record<string, SecuritySchemeObject | ReferenceObject>;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Contact information for the exposed API.
|
|
1046
|
+
*
|
|
1047
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* ```yaml
|
|
1051
|
+
* name: API Support
|
|
1052
|
+
* url: https://www.example.com/support
|
|
1053
|
+
* email: support@example.com
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
1056
|
+
interface ContactObject {
|
|
1057
|
+
/**
|
|
1058
|
+
* The email address of the contact person/organization. This MUST be in the form of an email address.
|
|
1059
|
+
*/
|
|
1060
|
+
email?: string;
|
|
1061
|
+
/**
|
|
1062
|
+
* The identifying name of the contact person/organization.
|
|
1063
|
+
*/
|
|
1064
|
+
name?: string;
|
|
1065
|
+
/**
|
|
1066
|
+
* The URL pointing to the contact information. This MUST be in the form of a URL.
|
|
1067
|
+
*/
|
|
1068
|
+
url?: string;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the document of an alternative schema based on the value associated with it.
|
|
1072
|
+
*
|
|
1073
|
+
* When using the discriminator, _inline_ schemas will not be considered.
|
|
1074
|
+
*
|
|
1075
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1076
|
+
*
|
|
1077
|
+
* The discriminator object is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`.
|
|
1078
|
+
*
|
|
1079
|
+
* In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:
|
|
1080
|
+
*
|
|
1081
|
+
* ```yaml
|
|
1082
|
+
* MyResponseType:
|
|
1083
|
+
* oneOf:
|
|
1084
|
+
* - $ref: '#/components/schemas/Cat'
|
|
1085
|
+
* - $ref: '#/components/schemas/Dog'
|
|
1086
|
+
* - $ref: '#/components/schemas/Lizard'
|
|
1087
|
+
* ```
|
|
1088
|
+
*
|
|
1089
|
+
* which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:
|
|
1090
|
+
*
|
|
1091
|
+
* ```yaml
|
|
1092
|
+
* MyResponseType:
|
|
1093
|
+
* oneOf:
|
|
1094
|
+
* - $ref: '#/components/schemas/Cat'
|
|
1095
|
+
* - $ref: '#/components/schemas/Dog'
|
|
1096
|
+
* - $ref: '#/components/schemas/Lizard'
|
|
1097
|
+
* discriminator:
|
|
1098
|
+
* propertyName: petType
|
|
1099
|
+
* ```
|
|
1100
|
+
*
|
|
1101
|
+
* The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:
|
|
1102
|
+
*
|
|
1103
|
+
* ```json
|
|
1104
|
+
* {
|
|
1105
|
+
* "id": 12345,
|
|
1106
|
+
* "petType": "Cat"
|
|
1107
|
+
* }
|
|
1108
|
+
* ```
|
|
1109
|
+
*
|
|
1110
|
+
* Will indicate that the `Cat` schema be used in conjunction with this payload.
|
|
1111
|
+
*
|
|
1112
|
+
* In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used:
|
|
1113
|
+
*
|
|
1114
|
+
* ```yaml
|
|
1115
|
+
* MyResponseType:
|
|
1116
|
+
* oneOf:
|
|
1117
|
+
* - $ref: '#/components/schemas/Cat'
|
|
1118
|
+
* - $ref: '#/components/schemas/Dog'
|
|
1119
|
+
* - $ref: '#/components/schemas/Lizard'
|
|
1120
|
+
* - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
|
|
1121
|
+
* discriminator:
|
|
1122
|
+
* propertyName: petType
|
|
1123
|
+
* mapping:
|
|
1124
|
+
* dog: '#/components/schemas/Dog'
|
|
1125
|
+
* monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
|
|
1126
|
+
* ```
|
|
1127
|
+
*
|
|
1128
|
+
* Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.
|
|
1129
|
+
*
|
|
1130
|
+
* When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.
|
|
1131
|
+
*
|
|
1132
|
+
* In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an `allOf` construct may be used as an alternate schema.
|
|
1133
|
+
*
|
|
1134
|
+
* For example:
|
|
1135
|
+
*
|
|
1136
|
+
* ```yaml
|
|
1137
|
+
* components:
|
|
1138
|
+
* schemas:
|
|
1139
|
+
* Pet:
|
|
1140
|
+
* type: object
|
|
1141
|
+
* required:
|
|
1142
|
+
* - petType
|
|
1143
|
+
* properties:
|
|
1144
|
+
* petType:
|
|
1145
|
+
* type: string
|
|
1146
|
+
* discriminator:
|
|
1147
|
+
* propertyName: petType
|
|
1148
|
+
* mapping:
|
|
1149
|
+
* dog: Dog
|
|
1150
|
+
* Cat:
|
|
1151
|
+
* allOf:
|
|
1152
|
+
* - $ref: '#/components/schemas/Pet'
|
|
1153
|
+
* - type: object
|
|
1154
|
+
* # all other properties specific to a `Cat`
|
|
1155
|
+
* properties:
|
|
1156
|
+
* name:
|
|
1157
|
+
* type: string
|
|
1158
|
+
* Dog:
|
|
1159
|
+
* allOf:
|
|
1160
|
+
* - $ref: '#/components/schemas/Pet'
|
|
1161
|
+
* - type: object
|
|
1162
|
+
* # all other properties specific to a `Dog`
|
|
1163
|
+
* properties:
|
|
1164
|
+
* bark:
|
|
1165
|
+
* type: string
|
|
1166
|
+
* Lizard:
|
|
1167
|
+
* allOf:
|
|
1168
|
+
* - $ref: '#/components/schemas/Pet'
|
|
1169
|
+
* - type: object
|
|
1170
|
+
* # all other properties specific to a `Lizard`
|
|
1171
|
+
* properties:
|
|
1172
|
+
* lovesRocks:
|
|
1173
|
+
* type: boolean
|
|
1174
|
+
* ```
|
|
1175
|
+
*
|
|
1176
|
+
* a payload like this:
|
|
1177
|
+
*
|
|
1178
|
+
* ```json
|
|
1179
|
+
* {
|
|
1180
|
+
* "petType": "Cat",
|
|
1181
|
+
* "name": "misty"
|
|
1182
|
+
* }
|
|
1183
|
+
* ```
|
|
1184
|
+
*
|
|
1185
|
+
* will indicate that the `Cat` schema be used. Likewise this schema:
|
|
1186
|
+
*
|
|
1187
|
+
* ```json
|
|
1188
|
+
* {
|
|
1189
|
+
* "petType": "dog",
|
|
1190
|
+
* "bark": "soft"
|
|
1191
|
+
* }
|
|
1192
|
+
* ```
|
|
1193
|
+
*
|
|
1194
|
+
* will map to `Dog` because of the definition in the `mapping` element.
|
|
1195
|
+
*/
|
|
1196
|
+
interface DiscriminatorObject {
|
|
1197
|
+
/**
|
|
1198
|
+
* An object to hold mappings between payload values and schema names or references.
|
|
1199
|
+
*/
|
|
1200
|
+
mapping?: Record<string, string>;
|
|
1201
|
+
/**
|
|
1202
|
+
* **REQUIRED**. The name of the property in the payload that will hold the discriminator value.
|
|
1203
|
+
*/
|
|
1204
|
+
propertyName: string;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* A single encoding definition applied to a single schema property.
|
|
1208
|
+
*
|
|
1209
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1210
|
+
*
|
|
1211
|
+
* @example
|
|
1212
|
+
* ```yaml
|
|
1213
|
+
* requestBody:
|
|
1214
|
+
* content:
|
|
1215
|
+
* multipart/form-data:
|
|
1216
|
+
* schema:
|
|
1217
|
+
* type: object
|
|
1218
|
+
* properties:
|
|
1219
|
+
* id:
|
|
1220
|
+
* # default is text/plain
|
|
1221
|
+
* type: string
|
|
1222
|
+
* format: uuid
|
|
1223
|
+
* address:
|
|
1224
|
+
* # default is application/json
|
|
1225
|
+
* type: object
|
|
1226
|
+
* properties: {}
|
|
1227
|
+
* historyMetadata:
|
|
1228
|
+
* # need to declare XML format!
|
|
1229
|
+
* description: metadata in XML format
|
|
1230
|
+
* type: object
|
|
1231
|
+
* properties: {}
|
|
1232
|
+
* profileImage: {}
|
|
1233
|
+
* encoding:
|
|
1234
|
+
* historyMetadata:
|
|
1235
|
+
* # require XML Content-Type in utf-8 encoding
|
|
1236
|
+
* contentType: application/xml; charset=utf-8
|
|
1237
|
+
* profileImage:
|
|
1238
|
+
* # only accept png/jpeg
|
|
1239
|
+
* contentType: image/png, image/jpeg
|
|
1240
|
+
* headers:
|
|
1241
|
+
* X-Rate-Limit-Limit:
|
|
1242
|
+
* description: The number of allowed requests in the current period
|
|
1243
|
+
* schema:
|
|
1244
|
+
* type: integer
|
|
1245
|
+
* ```
|
|
1246
|
+
*/
|
|
1247
|
+
interface EncodingObject {
|
|
1248
|
+
/**
|
|
1249
|
+
* Determines whether the parameter value SHOULD allow reserved characters, as defined by {@link https://tools.ietf.org/html/rfc3986#section-2.2 RFC3986} `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType `contentType`} (implicit or explicit) SHALL be ignored.
|
|
1250
|
+
*/
|
|
1251
|
+
allowReserved?: boolean;
|
|
1252
|
+
/**
|
|
1253
|
+
* The Content-Type for encoding a specific property. Default value depends on the property type: for `object` - `application/json`; for `array` – the default is defined based on the inner type; for all other cases the default is `application/octet-stream`. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types.
|
|
1254
|
+
*/
|
|
1255
|
+
contentType?: string;
|
|
1256
|
+
/**
|
|
1257
|
+
* When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingStyle `style`} is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType `contentType`} (implicit or explicit) SHALL be ignored.
|
|
1258
|
+
*/
|
|
1259
|
+
explode?: boolean;
|
|
1260
|
+
/**
|
|
1261
|
+
* A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`.
|
|
1262
|
+
*/
|
|
1263
|
+
headers?: Record<string, HeaderObject | ReferenceObject>;
|
|
1264
|
+
/**
|
|
1265
|
+
* Describes how a specific property value will be serialized depending on its type. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object Parameter Object} for details on the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType `contentType`} (implicit or explicit) SHALL be ignored.
|
|
1266
|
+
*/
|
|
1267
|
+
style?: string;
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1271
|
+
*
|
|
1272
|
+
* In all cases, the example value is expected to be compatible with the type schema of its associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.
|
|
1273
|
+
*
|
|
1274
|
+
* Example Object Examples
|
|
1275
|
+
*
|
|
1276
|
+
* In a request body:
|
|
1277
|
+
*
|
|
1278
|
+
* @example
|
|
1279
|
+
* ```yaml
|
|
1280
|
+
* requestBody:
|
|
1281
|
+
* content:
|
|
1282
|
+
* 'application/json':
|
|
1283
|
+
* schema:
|
|
1284
|
+
* $ref: '#/components/schemas/Address'
|
|
1285
|
+
* examples:
|
|
1286
|
+
* foo:
|
|
1287
|
+
* summary: A foo example
|
|
1288
|
+
* value: {"foo": "bar"}
|
|
1289
|
+
* bar:
|
|
1290
|
+
* summary: A bar example
|
|
1291
|
+
* value: {"bar": "baz"}
|
|
1292
|
+
* 'application/xml':
|
|
1293
|
+
* examples:
|
|
1294
|
+
* xmlExample:
|
|
1295
|
+
* summary: This is an example in XML
|
|
1296
|
+
* externalValue: 'https://example.org/examples/address-example.xml'
|
|
1297
|
+
* 'text/plain':
|
|
1298
|
+
* examples:
|
|
1299
|
+
* textExample:
|
|
1300
|
+
* summary: This is a text example
|
|
1301
|
+
* externalValue: 'https://foo.bar/examples/address-example.txt'
|
|
1302
|
+
* ```
|
|
1303
|
+
*
|
|
1304
|
+
* In a parameter:
|
|
1305
|
+
*
|
|
1306
|
+
* @example
|
|
1307
|
+
* ```yaml
|
|
1308
|
+
* parameters:
|
|
1309
|
+
* - name: 'zipCode'
|
|
1310
|
+
* in: 'query'
|
|
1311
|
+
* schema:
|
|
1312
|
+
* type: 'string'
|
|
1313
|
+
* format: 'zip-code'
|
|
1314
|
+
* examples:
|
|
1315
|
+
* zip-example:
|
|
1316
|
+
* $ref: '#/components/examples/zip-example'
|
|
1317
|
+
* ```
|
|
1318
|
+
*
|
|
1319
|
+
* In a response:
|
|
1320
|
+
*
|
|
1321
|
+
* @example
|
|
1322
|
+
* ```yaml
|
|
1323
|
+
* responses:
|
|
1324
|
+
* '200':
|
|
1325
|
+
* description: your car appointment has been booked
|
|
1326
|
+
* content:
|
|
1327
|
+
* application/json:
|
|
1328
|
+
* schema:
|
|
1329
|
+
* $ref: '#/components/schemas/SuccessResponse'
|
|
1330
|
+
* examples:
|
|
1331
|
+
* confirmation-success:
|
|
1332
|
+
* $ref: '#/components/examples/confirmation-success'
|
|
1333
|
+
* ```
|
|
1334
|
+
*/
|
|
1335
|
+
interface ExampleObject {
|
|
1336
|
+
/**
|
|
1337
|
+
* Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
1338
|
+
*/
|
|
1339
|
+
description?: string;
|
|
1340
|
+
/**
|
|
1341
|
+
* A URI that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris Relative References}.
|
|
1342
|
+
*/
|
|
1343
|
+
externalValue?: string;
|
|
1344
|
+
/**
|
|
1345
|
+
* Short description for the example.
|
|
1346
|
+
*/
|
|
1347
|
+
summary?: string;
|
|
1348
|
+
/**
|
|
1349
|
+
* Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
|
|
1350
|
+
*/
|
|
1351
|
+
value?: unknown;
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Allows referencing an external resource for extended documentation.
|
|
1355
|
+
*
|
|
1356
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1357
|
+
*
|
|
1358
|
+
* @example
|
|
1359
|
+
* ```yaml
|
|
1360
|
+
* description: Find more info here
|
|
1361
|
+
* url: https://example.com
|
|
1362
|
+
* ```
|
|
1363
|
+
*/
|
|
1364
|
+
interface ExternalDocumentationObject {
|
|
1365
|
+
/**
|
|
1366
|
+
* A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
1367
|
+
*/
|
|
1368
|
+
description?: string;
|
|
1369
|
+
/**
|
|
1370
|
+
* **REQUIRED**. The URL for the target documentation. This MUST be in the form of a URL.
|
|
1371
|
+
*/
|
|
1372
|
+
url: string;
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* The Header Object follows the structure of the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object Parameter Object} with the following changes:
|
|
1376
|
+
*
|
|
1377
|
+
* 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map.
|
|
1378
|
+
* 1. `in` MUST NOT be specified, it is implicitly in `header`.
|
|
1379
|
+
* 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`}).
|
|
1380
|
+
*
|
|
1381
|
+
* @example
|
|
1382
|
+
* ```yaml
|
|
1383
|
+
* description: The number of allowed requests in the current period
|
|
1384
|
+
* schema:
|
|
1385
|
+
* type: integer
|
|
1386
|
+
* ```
|
|
1387
|
+
*/
|
|
1388
|
+
interface HeaderObject extends Omit<ParameterObject, 'in' | 'name'> {
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
|
|
1392
|
+
*
|
|
1393
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1394
|
+
*
|
|
1395
|
+
* @example
|
|
1396
|
+
* ```yaml
|
|
1397
|
+
* title: Sample Pet Store App
|
|
1398
|
+
* summary: A pet store manager.
|
|
1399
|
+
* description: This is a sample server for a pet store.
|
|
1400
|
+
* termsOfService: https://example.com/terms/
|
|
1401
|
+
* contact:
|
|
1402
|
+
* name: API Support
|
|
1403
|
+
* url: https://www.example.com/support
|
|
1404
|
+
* email: support@example.com
|
|
1405
|
+
* license:
|
|
1406
|
+
* name: Apache 2.0
|
|
1407
|
+
* url: https://www.apache.org/licenses/LICENSE-2.0.html
|
|
1408
|
+
* version: 1.0.1
|
|
1409
|
+
* ```
|
|
1410
|
+
*/
|
|
1411
|
+
interface InfoObject {
|
|
1412
|
+
/**
|
|
1413
|
+
* The contact information for the exposed API.
|
|
1414
|
+
*/
|
|
1415
|
+
contact?: ContactObject;
|
|
1416
|
+
/**
|
|
1417
|
+
* A description of the API. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
1418
|
+
*/
|
|
1419
|
+
description?: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* The license information for the exposed API.
|
|
1422
|
+
*/
|
|
1423
|
+
license?: LicenseObject;
|
|
1424
|
+
/**
|
|
1425
|
+
* A short summary of the API.
|
|
1426
|
+
*/
|
|
1427
|
+
summary?: string;
|
|
1428
|
+
/**
|
|
1429
|
+
* A URL to the Terms of Service for the API. This MUST be in the form of a URL.
|
|
1430
|
+
*/
|
|
1431
|
+
termsOfService?: string;
|
|
1432
|
+
/**
|
|
1433
|
+
* **REQUIRED**. The title of the API.
|
|
1434
|
+
*/
|
|
1435
|
+
title: string;
|
|
1436
|
+
/**
|
|
1437
|
+
* **REQUIRED**. The version of the OpenAPI document (which is distinct from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasVersion OpenAPI Specification version} or the API implementation version).
|
|
1438
|
+
*/
|
|
1439
|
+
version: string;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* License information for the exposed API.
|
|
1443
|
+
*
|
|
1444
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1445
|
+
*
|
|
1446
|
+
* @example
|
|
1447
|
+
* ```yaml
|
|
1448
|
+
* name: Apache 2.0
|
|
1449
|
+
* identifier: Apache-2.0
|
|
1450
|
+
* ```
|
|
1451
|
+
*/
|
|
1452
|
+
interface LicenseObject {
|
|
1453
|
+
/**
|
|
1454
|
+
* An {@link https://spdx.org/licenses/ SPDX} license expression for the API. The `identifier` field is mutually exclusive of the `url` field.
|
|
1455
|
+
*/
|
|
1456
|
+
identifier?: string;
|
|
1457
|
+
/**
|
|
1458
|
+
* **REQUIRED**. The license name used for the API.
|
|
1459
|
+
*/
|
|
1460
|
+
name: string;
|
|
1461
|
+
/**
|
|
1462
|
+
* A URL to the license used for the API. This MUST be in the form of a URL. The `url` field is mutually exclusive of the `identifier` field.
|
|
1463
|
+
*/
|
|
1464
|
+
url?: string;
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.
|
|
1468
|
+
*
|
|
1469
|
+
* Unlike _dynamic_ links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.
|
|
1470
|
+
*
|
|
1471
|
+
* For computing links, and providing instructions to execute them, a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#runtime-expressions runtime expression} is used for accessing values in an operation and using them as parameters while invoking the linked operation.
|
|
1472
|
+
*
|
|
1473
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1474
|
+
*
|
|
1475
|
+
* A linked operation MUST be identified using either an `operationRef` or `operationId`. In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, the `operationRef` syntax is preferred for OpenAPI documents with external references.
|
|
1476
|
+
*
|
|
1477
|
+
* **Examples**
|
|
1478
|
+
*
|
|
1479
|
+
* Computing a link from a request operation where the `$request.path.id` is used to pass a request parameter to the linked operation.
|
|
1480
|
+
*
|
|
1481
|
+
* ```yaml
|
|
1482
|
+
* paths:
|
|
1483
|
+
* /users/{id}:
|
|
1484
|
+
* parameters:
|
|
1485
|
+
* - name: id
|
|
1486
|
+
* in: path
|
|
1487
|
+
* required: true
|
|
1488
|
+
* description: the user identifier, as userId
|
|
1489
|
+
* schema:
|
|
1490
|
+
* type: string
|
|
1491
|
+
* get:
|
|
1492
|
+
* responses:
|
|
1493
|
+
* '200':
|
|
1494
|
+
* description: the user being returned
|
|
1495
|
+
* content:
|
|
1496
|
+
* application/json:
|
|
1497
|
+
* schema:
|
|
1498
|
+
* type: object
|
|
1499
|
+
* properties:
|
|
1500
|
+
* uuid: # the unique user id
|
|
1501
|
+
* type: string
|
|
1502
|
+
* format: uuid
|
|
1503
|
+
* links:
|
|
1504
|
+
* address:
|
|
1505
|
+
* # the target link operationId
|
|
1506
|
+
* operationId: getUserAddress
|
|
1507
|
+
* parameters:
|
|
1508
|
+
* # get the `id` field from the request path parameter named `id`
|
|
1509
|
+
* userId: $request.path.id
|
|
1510
|
+
* # the path item of the linked operation
|
|
1511
|
+
* /users/{userid}/address:
|
|
1512
|
+
* parameters:
|
|
1513
|
+
* - name: userid
|
|
1514
|
+
* in: path
|
|
1515
|
+
* required: true
|
|
1516
|
+
* description: the user identifier, as userId
|
|
1517
|
+
* schema:
|
|
1518
|
+
* type: string
|
|
1519
|
+
* # linked operation
|
|
1520
|
+
* get:
|
|
1521
|
+
* operationId: getUserAddress
|
|
1522
|
+
* responses:
|
|
1523
|
+
* '200':
|
|
1524
|
+
* description: the user's address
|
|
1525
|
+
* ```
|
|
1526
|
+
*
|
|
1527
|
+
* When a runtime expression fails to evaluate, no parameter value is passed to the target operation.
|
|
1528
|
+
*
|
|
1529
|
+
* Values from the response body can be used to drive a linked operation.
|
|
1530
|
+
*
|
|
1531
|
+
* ```yaml
|
|
1532
|
+
* links:
|
|
1533
|
+
* address:
|
|
1534
|
+
* operationId: getUserAddressByUUID
|
|
1535
|
+
* parameters:
|
|
1536
|
+
* # get the `uuid` field from the `uuid` field in the response body
|
|
1537
|
+
* userUuid: $response.body#/uuid
|
|
1538
|
+
* ```
|
|
1539
|
+
*
|
|
1540
|
+
* Clients follow all links at their discretion. Neither permissions, nor the capability to make a successful call to that link, is guaranteed solely by the existence of a relationship.
|
|
1541
|
+
*
|
|
1542
|
+
* **OperationRef Examples**
|
|
1543
|
+
*
|
|
1544
|
+
* As references to `operationId` MAY NOT be possible (the `operationId` is an optional field in an {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object}), references MAY also be made through a relative `operationRef`:
|
|
1545
|
+
*
|
|
1546
|
+
* ```yaml
|
|
1547
|
+
* links:
|
|
1548
|
+
* UserRepositories:
|
|
1549
|
+
* # returns array of '#/components/schemas/repository'
|
|
1550
|
+
* operationRef: '#/paths/~12.0~1repositories~1{username}/get'
|
|
1551
|
+
* parameters:
|
|
1552
|
+
* username: $response.body#/username
|
|
1553
|
+
* ```
|
|
1554
|
+
*
|
|
1555
|
+
* or an absolute `operationRef`:
|
|
1556
|
+
*
|
|
1557
|
+
* ```yaml
|
|
1558
|
+
* links:
|
|
1559
|
+
* UserRepositories:
|
|
1560
|
+
* # returns array of '#/components/schemas/repository'
|
|
1561
|
+
* operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
|
|
1562
|
+
* parameters:
|
|
1563
|
+
* username: $response.body#/username
|
|
1564
|
+
* ```
|
|
1565
|
+
*
|
|
1566
|
+
* Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when using JSON references.
|
|
1567
|
+
*
|
|
1568
|
+
* **Runtime Expressions**
|
|
1569
|
+
*
|
|
1570
|
+
* Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. This mechanism is used by {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#link-object Link Objects} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}.
|
|
1571
|
+
*
|
|
1572
|
+
* The runtime expression is defined by the following {@link https://tools.ietf.org/html/rfc5234 ABNF} syntax
|
|
1573
|
+
*
|
|
1574
|
+
* ```abnf
|
|
1575
|
+
* expression = ( "$url" / "$method" / "$statusCode" / "$request." source / "$response." source )
|
|
1576
|
+
* source = ( header-reference / query-reference / path-reference / body-reference )
|
|
1577
|
+
* header-reference = "header." token
|
|
1578
|
+
* query-reference = "query." name
|
|
1579
|
+
* path-reference = "path." name
|
|
1580
|
+
* body-reference = "body" ["#" json-pointer ]
|
|
1581
|
+
* json-pointer = *( "/" reference-token )
|
|
1582
|
+
* reference-token = *( unescaped / escaped )
|
|
1583
|
+
* unescaped = %x00-2E / %x30-7D / %x7F-10FFFF
|
|
1584
|
+
* ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'
|
|
1585
|
+
* escaped = "~" ( "0" / "1" )
|
|
1586
|
+
* ; representing '~' and '/', respectively
|
|
1587
|
+
* name = *( CHAR )
|
|
1588
|
+
* token = 1*tchar
|
|
1589
|
+
* tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
|
|
1590
|
+
* "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
|
|
1591
|
+
* ```
|
|
1592
|
+
*
|
|
1593
|
+
* Here, `json-pointer` is taken from {@link https://tools.ietf.org/html/rfc6901 RFC6901}, `char` from {@link https://tools.ietf.org/html/rfc7159#section-7 RFC7159} and `token` from {@link https://tools.ietf.org/html/rfc7230#section-3.2.6 RFC7230}.
|
|
1594
|
+
*
|
|
1595
|
+
* The `name` identifier is case-sensitive, whereas `token` is not.
|
|
1596
|
+
*
|
|
1597
|
+
* The table below provides examples of runtime expressions and examples of their use in a value:
|
|
1598
|
+
*
|
|
1599
|
+
* **Examples**
|
|
1600
|
+
*
|
|
1601
|
+
* | Source Location | example expression | notes |
|
|
1602
|
+
* | -------- | ------- | ------- |
|
|
1603
|
+
* | HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation. |
|
|
1604
|
+
* | Requested media type | `$request.header.accept` | |
|
|
1605
|
+
* | Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section of the parent operation or they cannot be evaluated. This includes request headers. |
|
|
1606
|
+
* | Request body property | `$request.body#/user/uuid` | In operations which accept payloads, references may be made to portions of the `requestBody` or the entire body. |
|
|
1607
|
+
* | Request URL | `$url` | |
|
|
1608
|
+
* | Response value | `$response.body#/status` | In operations which return payloads, references may be made to portions of the response body or the entire body. |
|
|
1609
|
+
* | Response header | `$response.header.Server` | Single header values only are available |
|
|
1610
|
+
*
|
|
1611
|
+
* Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with `{}` curly braces.
|
|
1612
|
+
*/
|
|
1613
|
+
interface LinkObject {
|
|
1614
|
+
/**
|
|
1615
|
+
* A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
1616
|
+
*/
|
|
1617
|
+
description?: string;
|
|
1618
|
+
/**
|
|
1619
|
+
* The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field.
|
|
1620
|
+
*/
|
|
1621
|
+
operationId?: string;
|
|
1622
|
+
/**
|
|
1623
|
+
* A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object}. Relative `operationRef` values MAY be used to locate an existing {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object} in the OpenAPI definition. See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris Relative References}.
|
|
1624
|
+
*/
|
|
1625
|
+
operationRef?: string;
|
|
1626
|
+
/**
|
|
1627
|
+
* A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn parameter location} `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id).
|
|
1628
|
+
*/
|
|
1629
|
+
parameters?: Record<string, unknown | string>;
|
|
1630
|
+
/**
|
|
1631
|
+
* A literal value or {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#runtime-expressions {expression}} to use as a request body when calling the target operation.
|
|
1632
|
+
*/
|
|
1633
|
+
requestBody?: unknown | string;
|
|
1634
|
+
/**
|
|
1635
|
+
* A server object to be used by the target operation.
|
|
1636
|
+
*/
|
|
1637
|
+
server?: ServerObject;
|
|
1638
|
+
}
|
|
1639
|
+
/**
|
|
1640
|
+
* Each Media Type Object provides schema and examples for the media type identified by its key.
|
|
1641
|
+
*
|
|
1642
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1643
|
+
*
|
|
1644
|
+
* **Media Type Examples**
|
|
1645
|
+
*
|
|
1646
|
+
* @example
|
|
1647
|
+
* ```yaml
|
|
1648
|
+
* application/json:
|
|
1649
|
+
* schema:
|
|
1650
|
+
* $ref: "#/components/schemas/Pet"
|
|
1651
|
+
* examples:
|
|
1652
|
+
* cat:
|
|
1653
|
+
* summary: An example of a cat
|
|
1654
|
+
* value:
|
|
1655
|
+
* name: Fluffy
|
|
1656
|
+
* petType: Cat
|
|
1657
|
+
* color: White
|
|
1658
|
+
* gender: male
|
|
1659
|
+
* breed: Persian
|
|
1660
|
+
* dog:
|
|
1661
|
+
* summary: An example of a dog with a cat's name
|
|
1662
|
+
* value:
|
|
1663
|
+
* name: Puma
|
|
1664
|
+
* petType: Dog
|
|
1665
|
+
* color: Black
|
|
1666
|
+
* gender: Female
|
|
1667
|
+
* breed: Mixed
|
|
1668
|
+
* frog:
|
|
1669
|
+
* $ref: "#/components/examples/frog-example"
|
|
1670
|
+
* ```
|
|
1671
|
+
*/
|
|
1672
|
+
interface MediaTypeObject {
|
|
1673
|
+
/**
|
|
1674
|
+
* A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`.
|
|
1675
|
+
*/
|
|
1676
|
+
encoding?: Record<string, EncodingObject>;
|
|
1677
|
+
/**
|
|
1678
|
+
* Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema.
|
|
1679
|
+
*/
|
|
1680
|
+
example?: unknown;
|
|
1681
|
+
/**
|
|
1682
|
+
* Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema.
|
|
1683
|
+
*/
|
|
1684
|
+
examples?: Record<string, ExampleObject | ReferenceObject>;
|
|
1685
|
+
/**
|
|
1686
|
+
* The schema defining the content of the request, response, or parameter.
|
|
1687
|
+
*/
|
|
1688
|
+
schema?: SchemaObject;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Configuration details for a supported OAuth Flow
|
|
1692
|
+
*
|
|
1693
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1694
|
+
*
|
|
1695
|
+
* **OAuth Flow Object Examples**
|
|
1696
|
+
*
|
|
1697
|
+
* ```yaml
|
|
1698
|
+
* type: oauth2
|
|
1699
|
+
* flows:
|
|
1700
|
+
* implicit:
|
|
1701
|
+
* authorizationUrl: https://example.com/api/oauth/dialog
|
|
1702
|
+
* scopes:
|
|
1703
|
+
* write:pets: modify pets in your account
|
|
1704
|
+
* read:pets: read your pets
|
|
1705
|
+
* authorizationCode:
|
|
1706
|
+
* authorizationUrl: https://example.com/api/oauth/dialog
|
|
1707
|
+
* tokenUrl: https://example.com/api/oauth/token
|
|
1708
|
+
* scopes:
|
|
1709
|
+
* write:pets: modify pets in your account
|
|
1710
|
+
* read:pets: read your pets
|
|
1711
|
+
* ```
|
|
1712
|
+
*/
|
|
1713
|
+
interface OAuthFlowObject {
|
|
1714
|
+
/**
|
|
1715
|
+
* **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.
|
|
1716
|
+
*/
|
|
1717
|
+
authorizationUrl: string;
|
|
1718
|
+
/**
|
|
1719
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.
|
|
1720
|
+
*/
|
|
1721
|
+
refreshUrl?: string;
|
|
1722
|
+
/**
|
|
1723
|
+
* **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty.
|
|
1724
|
+
*/
|
|
1725
|
+
scopes: Record<string, string>;
|
|
1726
|
+
/**
|
|
1727
|
+
* **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS.
|
|
1728
|
+
*/
|
|
1729
|
+
tokenUrl: string;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Allows configuration of the supported OAuth Flows.
|
|
1733
|
+
*
|
|
1734
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1735
|
+
*/
|
|
1736
|
+
interface OAuthFlowsObject {
|
|
1737
|
+
/**
|
|
1738
|
+
* Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0.
|
|
1739
|
+
*/
|
|
1740
|
+
authorizationCode?: OAuthFlowObject;
|
|
1741
|
+
/**
|
|
1742
|
+
* Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0.
|
|
1743
|
+
*/
|
|
1744
|
+
clientCredentials?: OAuthFlowObject;
|
|
1745
|
+
/**
|
|
1746
|
+
* Configuration for the OAuth Implicit flow
|
|
1747
|
+
*/
|
|
1748
|
+
implicit?: OAuthFlowObject;
|
|
1749
|
+
/**
|
|
1750
|
+
* Configuration for the OAuth Resource Owner Password flow
|
|
1751
|
+
*/
|
|
1752
|
+
password?: OAuthFlowObject;
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Describes a single API operation on a path.
|
|
1756
|
+
*
|
|
1757
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1758
|
+
*
|
|
1759
|
+
* @example
|
|
1760
|
+
* ```yaml
|
|
1761
|
+
* tags:
|
|
1762
|
+
* - pet
|
|
1763
|
+
* summary: Updates a pet in the store with form data
|
|
1764
|
+
* operationId: updatePetWithForm
|
|
1765
|
+
* parameters:
|
|
1766
|
+
* - name: petId
|
|
1767
|
+
* in: path
|
|
1768
|
+
* description: ID of pet that needs to be updated
|
|
1769
|
+
* required: true
|
|
1770
|
+
* schema:
|
|
1771
|
+
* type: string
|
|
1772
|
+
* requestBody:
|
|
1773
|
+
* content:
|
|
1774
|
+
* 'application/x-www-form-urlencoded':
|
|
1775
|
+
* schema:
|
|
1776
|
+
* type: object
|
|
1777
|
+
* properties:
|
|
1778
|
+
* name:
|
|
1779
|
+
* description: Updated name of the pet
|
|
1780
|
+
* type: string
|
|
1781
|
+
* status:
|
|
1782
|
+
* description: Updated status of the pet
|
|
1783
|
+
* type: string
|
|
1784
|
+
* required:
|
|
1785
|
+
* - status
|
|
1786
|
+
* responses:
|
|
1787
|
+
* '200':
|
|
1788
|
+
* description: Pet updated.
|
|
1789
|
+
* content:
|
|
1790
|
+
* 'application/json': {}
|
|
1791
|
+
* 'application/xml': {}
|
|
1792
|
+
* '405':
|
|
1793
|
+
* description: Method Not Allowed
|
|
1794
|
+
* content:
|
|
1795
|
+
* 'application/json': {}
|
|
1796
|
+
* 'application/xml': {}
|
|
1797
|
+
* security:
|
|
1798
|
+
* - petstore_auth:
|
|
1799
|
+
* - write:pets
|
|
1800
|
+
* - read:pets
|
|
1801
|
+
* ```
|
|
1802
|
+
*/
|
|
1803
|
+
interface OperationObject {
|
|
1804
|
+
/**
|
|
1805
|
+
* A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Object} that describes a request that may be initiated by the API provider and the expected responses.
|
|
1806
|
+
*/
|
|
1807
|
+
callbacks?: Record<string, CallbackObject | ReferenceObject>;
|
|
1808
|
+
/**
|
|
1809
|
+
* Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`.
|
|
1810
|
+
*/
|
|
1811
|
+
deprecated?: boolean;
|
|
1812
|
+
/**
|
|
1813
|
+
* A verbose explanation of the operation behavior. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
1814
|
+
*/
|
|
1815
|
+
description?: string;
|
|
1816
|
+
/**
|
|
1817
|
+
* Additional external documentation for this operation.
|
|
1818
|
+
*/
|
|
1819
|
+
externalDocs?: ExternalDocumentationObject;
|
|
1820
|
+
/**
|
|
1821
|
+
* Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is **case-sensitive**. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.
|
|
1822
|
+
*/
|
|
1823
|
+
operationId?: string;
|
|
1824
|
+
/**
|
|
1825
|
+
* A list of parameters that are applicable for this operation. If a parameter is already defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemParameters Path Item}, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterName name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn location}. The list can use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object Reference Object} to link to parameters that are defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsParameters OpenAPI Object's components/parameters}.
|
|
1826
|
+
*/
|
|
1827
|
+
parameters?: ReadonlyArray<ParameterObject | ReferenceObject>;
|
|
1828
|
+
/**
|
|
1829
|
+
* The request body applicable for this operation. The `requestBody` is fully supported in HTTP methods where the HTTP 1.1 specification {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1 RFC7231} has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1 GET}, {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.2 HEAD} and {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.5 DELETE}), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible.
|
|
1830
|
+
*/
|
|
1831
|
+
requestBody?: RequestBodyObject | ReferenceObject;
|
|
1832
|
+
/**
|
|
1833
|
+
* The list of possible responses as they are returned from executing this operation.
|
|
1834
|
+
*/
|
|
1835
|
+
responses?: ResponsesObject;
|
|
1836
|
+
/**
|
|
1837
|
+
* A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasSecurity `security`}. To remove a top-level security declaration, an empty array can be used.
|
|
1838
|
+
*/
|
|
1839
|
+
security?: ReadonlyArray<SecurityRequirementObject>;
|
|
1840
|
+
/**
|
|
1841
|
+
* An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value.
|
|
1842
|
+
*/
|
|
1843
|
+
servers?: ReadonlyArray<ServerObject>;
|
|
1844
|
+
/**
|
|
1845
|
+
* A short summary of what the operation does.
|
|
1846
|
+
*/
|
|
1847
|
+
summary?: string;
|
|
1848
|
+
/**
|
|
1849
|
+
* A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
|
|
1850
|
+
*/
|
|
1851
|
+
tags?: ReadonlyArray<string>;
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Describes a single operation parameter.
|
|
1855
|
+
*
|
|
1856
|
+
* A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterName name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn location}.
|
|
1857
|
+
*
|
|
1858
|
+
* **Parameter Locations**
|
|
1859
|
+
*
|
|
1860
|
+
* There are four possible parameter locations specified by the `in` field:
|
|
1861
|
+
*
|
|
1862
|
+
* - path - Used together with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating Path Templating}, where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`.
|
|
1863
|
+
* - query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.
|
|
1864
|
+
* - header - Custom headers that are expected as part of the request. Note that {@link https://datatracker.ietf.org/doc/html/rfc7230#page-22 RFC7230} states header names are case insensitive.
|
|
1865
|
+
* - cookie - Used to pass a specific cookie value to the API.
|
|
1866
|
+
*
|
|
1867
|
+
* The rules for serialization of the parameter are specified in one of two ways. For simpler scenarios, a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterSchema `schema`} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} can describe the structure and syntax of the parameter.
|
|
1868
|
+
*
|
|
1869
|
+
* For more complex scenarios, the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterContent `content`} property can define the media type and schema of the parameter. A parameter MUST contain either a `schema` property, or a `content` property, but not both. When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter.
|
|
1870
|
+
*
|
|
1871
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
1872
|
+
*
|
|
1873
|
+
* A header parameter with an array of 64 bit integer numbers:
|
|
1874
|
+
*
|
|
1875
|
+
* @example
|
|
1876
|
+
* ```yaml
|
|
1877
|
+
* name: token
|
|
1878
|
+
* in: header
|
|
1879
|
+
* description: token to be passed as a header
|
|
1880
|
+
* required: true
|
|
1881
|
+
* schema:
|
|
1882
|
+
* type: array
|
|
1883
|
+
* items:
|
|
1884
|
+
* type: integer
|
|
1885
|
+
* format: int64
|
|
1886
|
+
* style: simple
|
|
1887
|
+
* ```
|
|
1888
|
+
*
|
|
1889
|
+
* A path parameter of a string value:
|
|
1890
|
+
*
|
|
1891
|
+
* @example
|
|
1892
|
+
* ```yaml
|
|
1893
|
+
* name: username
|
|
1894
|
+
* in: path
|
|
1895
|
+
* description: username to fetch
|
|
1896
|
+
* required: true
|
|
1897
|
+
* schema:
|
|
1898
|
+
* type: string
|
|
1899
|
+
* ```
|
|
1900
|
+
*
|
|
1901
|
+
* An optional query parameter of a string value, allowing multiple values by repeating the query parameter:
|
|
1902
|
+
*
|
|
1903
|
+
* @example
|
|
1904
|
+
* ```yaml
|
|
1905
|
+
* name: id
|
|
1906
|
+
* in: query
|
|
1907
|
+
* description: ID of the object to fetch
|
|
1908
|
+
* required: false
|
|
1909
|
+
* schema:
|
|
1910
|
+
* type: array
|
|
1911
|
+
* items:
|
|
1912
|
+
* type: string
|
|
1913
|
+
* style: form
|
|
1914
|
+
* explode: true
|
|
1915
|
+
* ```
|
|
1916
|
+
*
|
|
1917
|
+
* A free-form query parameter, allowing undefined parameters of a specific type:
|
|
1918
|
+
*
|
|
1919
|
+
* @example
|
|
1920
|
+
* ```yaml
|
|
1921
|
+
* in: query
|
|
1922
|
+
* name: freeForm
|
|
1923
|
+
* schema:
|
|
1924
|
+
* type: object
|
|
1925
|
+
* additionalProperties:
|
|
1926
|
+
* type: integer
|
|
1927
|
+
* style: form
|
|
1928
|
+
* ```
|
|
1929
|
+
*
|
|
1930
|
+
* A complex parameter using `content` to define serialization:
|
|
1931
|
+
*
|
|
1932
|
+
* @example
|
|
1933
|
+
* ```yaml
|
|
1934
|
+
* in: query
|
|
1935
|
+
* name: coordinates
|
|
1936
|
+
* content:
|
|
1937
|
+
* application/json:
|
|
1938
|
+
* schema:
|
|
1939
|
+
* type: object
|
|
1940
|
+
* required:
|
|
1941
|
+
* - lat
|
|
1942
|
+
* - long
|
|
1943
|
+
* properties:
|
|
1944
|
+
* lat:
|
|
1945
|
+
* type: number
|
|
1946
|
+
* long:
|
|
1947
|
+
* type: number
|
|
1948
|
+
* ```
|
|
1949
|
+
*/
|
|
1950
|
+
interface ParameterObject {
|
|
1951
|
+
/**
|
|
1952
|
+
* Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
|
|
1953
|
+
*/
|
|
1954
|
+
allowEmptyValue?: boolean;
|
|
1955
|
+
/**
|
|
1956
|
+
* Determines whether the parameter value SHOULD allow reserved characters, as defined by {@link https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 RFC3986} `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`.
|
|
1957
|
+
*/
|
|
1958
|
+
allowReserved?: boolean;
|
|
1959
|
+
/**
|
|
1960
|
+
* A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
|
|
1961
|
+
*/
|
|
1962
|
+
content?: Record<string, MediaTypeObject>;
|
|
1963
|
+
/**
|
|
1964
|
+
* Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`.
|
|
1965
|
+
*/
|
|
1966
|
+
deprecated?: boolean;
|
|
1967
|
+
/**
|
|
1968
|
+
* A brief description of the parameter. This could contain examples of use. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
1969
|
+
*/
|
|
1970
|
+
description?: string;
|
|
1971
|
+
/**
|
|
1972
|
+
* Example of the parameter's potential value. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` that contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
|
|
1973
|
+
*/
|
|
1974
|
+
example?: unknown;
|
|
1975
|
+
/**
|
|
1976
|
+
* Examples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL _override_ the example provided by the schema.
|
|
1977
|
+
*/
|
|
1978
|
+
examples?: Record<string, ExampleObject | ReferenceObject>;
|
|
1979
|
+
/**
|
|
1980
|
+
* When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} is `form`, the default value is `true`. For all other styles, the default value is `false`.
|
|
1981
|
+
*/
|
|
1982
|
+
explode?: boolean;
|
|
1983
|
+
/**
|
|
1984
|
+
* **REQUIRED**. The location of the parameter. Possible values are `"query"`, `"header"`, `"path"` or `"cookie"`.
|
|
1985
|
+
*/
|
|
1986
|
+
in: 'cookie' | 'header' | 'path' | 'query';
|
|
1987
|
+
/**
|
|
1988
|
+
* **REQUIRED**. The name of the parameter. Parameter names are _case sensitive_.
|
|
1989
|
+
* - If {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn `in`} is `"path"`, the `name` field MUST correspond to a template expression occurring within the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsPath path} field in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object Paths Object}. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating Path Templating} for further information.
|
|
1990
|
+
* - If {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn `in`} is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
|
|
1991
|
+
* - For all other cases, the `name` corresponds to the parameter name used by the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn `in`} property.
|
|
1992
|
+
*/
|
|
1993
|
+
name: string;
|
|
1994
|
+
/**
|
|
1995
|
+
* Determines whether this parameter is mandatory. If the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn parameter location} is `"path"`, this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.
|
|
1996
|
+
*/
|
|
1997
|
+
required?: boolean;
|
|
1998
|
+
/**
|
|
1999
|
+
* The schema defining the type used for the parameter.
|
|
2000
|
+
*/
|
|
2001
|
+
schema?: SchemaObject;
|
|
2002
|
+
/**
|
|
2003
|
+
* Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`.
|
|
2004
|
+
*/
|
|
2005
|
+
style?: 'deepObject' | 'form' | 'label' | 'matrix' | 'pipeDelimited' | 'simple' | 'spaceDelimited';
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* Describes the operations available on a single path. A Path Item MAY be empty, due to {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-filtering ACL constraints}. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
|
|
2009
|
+
*
|
|
2010
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2011
|
+
*
|
|
2012
|
+
* @example
|
|
2013
|
+
* ```yaml
|
|
2014
|
+
* get:
|
|
2015
|
+
* description: Returns pets based on ID
|
|
2016
|
+
* summary: Find pets by ID
|
|
2017
|
+
* operationId: getPetsById
|
|
2018
|
+
* responses:
|
|
2019
|
+
* '200':
|
|
2020
|
+
* description: pet response
|
|
2021
|
+
* content:
|
|
2022
|
+
* '*\/*':
|
|
2023
|
+
* schema:
|
|
2024
|
+
* type: array
|
|
2025
|
+
* items:
|
|
2026
|
+
* $ref: '#/components/schemas/Pet'
|
|
2027
|
+
* default:
|
|
2028
|
+
* description: error payload
|
|
2029
|
+
* content:
|
|
2030
|
+
* 'text/html':
|
|
2031
|
+
* schema:
|
|
2032
|
+
* $ref: '#/components/schemas/ErrorModel'
|
|
2033
|
+
* parameters:
|
|
2034
|
+
* - name: id
|
|
2035
|
+
* in: path
|
|
2036
|
+
* description: ID of pet to use
|
|
2037
|
+
* required: true
|
|
2038
|
+
* schema:
|
|
2039
|
+
* type: array
|
|
2040
|
+
* items:
|
|
2041
|
+
* type: string
|
|
2042
|
+
* style: simple
|
|
2043
|
+
* ```
|
|
2044
|
+
*/
|
|
2045
|
+
interface PathItemObject {
|
|
2046
|
+
/**
|
|
2047
|
+
* Allows for a referenced definition of this path item. The referenced structure MUST be in the form of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object}. In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris Relative References}.
|
|
2048
|
+
*/
|
|
2049
|
+
$ref?: string;
|
|
2050
|
+
/**
|
|
2051
|
+
* A definition of a DELETE operation on this path.
|
|
2052
|
+
*/
|
|
2053
|
+
delete?: OperationObject;
|
|
2054
|
+
/**
|
|
2055
|
+
* An optional, string description, intended to apply to all operations in this path. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
2056
|
+
*/
|
|
2057
|
+
description?: string;
|
|
2058
|
+
/**
|
|
2059
|
+
* A definition of a GET operation on this path.
|
|
2060
|
+
*/
|
|
2061
|
+
get?: OperationObject;
|
|
2062
|
+
/**
|
|
2063
|
+
* A definition of a HEAD operation on this path.
|
|
2064
|
+
*/
|
|
2065
|
+
head?: OperationObject;
|
|
2066
|
+
/**
|
|
2067
|
+
* A definition of a OPTIONS operation on this path.
|
|
2068
|
+
*/
|
|
2069
|
+
options?: OperationObject;
|
|
2070
|
+
/**
|
|
2071
|
+
* A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterName name} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn location}. The list can use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object Reference Object} to link to parameters that are defined at the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsParameters OpenAPI Object's components/parameters}.
|
|
2072
|
+
*/
|
|
2073
|
+
parameters?: ReadonlyArray<ParameterObject | ReferenceObject>;
|
|
2074
|
+
/**
|
|
2075
|
+
* A definition of a PATCH operation on this path.
|
|
2076
|
+
*/
|
|
2077
|
+
patch?: OperationObject;
|
|
2078
|
+
/**
|
|
2079
|
+
* A definition of a POST operation on this path.
|
|
2080
|
+
*/
|
|
2081
|
+
post?: OperationObject;
|
|
2082
|
+
/**
|
|
2083
|
+
* A definition of a PUT operation on this path.
|
|
2084
|
+
*/
|
|
2085
|
+
put?: OperationObject;
|
|
2086
|
+
/**
|
|
2087
|
+
* An alternative `server` array to service all operations in this path.
|
|
2088
|
+
*/
|
|
2089
|
+
servers?: ReadonlyArray<ServerObject>;
|
|
2090
|
+
/**
|
|
2091
|
+
* An optional, string summary, intended to apply to all operations in this path.
|
|
2092
|
+
*/
|
|
2093
|
+
summary?: string;
|
|
2094
|
+
/**
|
|
2095
|
+
* A definition of a TRACE operation on this path.
|
|
2096
|
+
*/
|
|
2097
|
+
trace?: OperationObject;
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object `Server Object`} in order to construct the full URL. The Paths MAY be empty, due to {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-filtering Access Control List (ACL) constraints}.
|
|
2101
|
+
*
|
|
2102
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2103
|
+
*
|
|
2104
|
+
* **Path Templating Matching**
|
|
2105
|
+
*
|
|
2106
|
+
* Assuming the following paths, the concrete definition, `/pets/mine`, will be matched first if used:
|
|
2107
|
+
*
|
|
2108
|
+
* ```
|
|
2109
|
+
* /pets/{petId}
|
|
2110
|
+
* /pets/mine
|
|
2111
|
+
* ```
|
|
2112
|
+
*
|
|
2113
|
+
* The following paths are considered identical and invalid:
|
|
2114
|
+
*
|
|
2115
|
+
* ```
|
|
2116
|
+
* /pets/{petId}
|
|
2117
|
+
* /pets/{name}
|
|
2118
|
+
* ```
|
|
2119
|
+
*
|
|
2120
|
+
* The following may lead to ambiguous resolution:
|
|
2121
|
+
*
|
|
2122
|
+
* ```
|
|
2123
|
+
* /{entity}/me
|
|
2124
|
+
* /books/{id}
|
|
2125
|
+
* ```
|
|
2126
|
+
*
|
|
2127
|
+
* **Paths Object Example**
|
|
2128
|
+
*
|
|
2129
|
+
* ```yaml
|
|
2130
|
+
* /pets:
|
|
2131
|
+
* get:
|
|
2132
|
+
* description: Returns all pets from the system that the user has access to
|
|
2133
|
+
* responses:
|
|
2134
|
+
* '200':
|
|
2135
|
+
* description: A list of pets.
|
|
2136
|
+
* content:
|
|
2137
|
+
* application/json:
|
|
2138
|
+
* schema:
|
|
2139
|
+
* type: array
|
|
2140
|
+
* items:
|
|
2141
|
+
* $ref: '#/components/schemas/pet'
|
|
2142
|
+
* ```
|
|
2143
|
+
*/
|
|
2144
|
+
interface PathsObject {
|
|
2145
|
+
/**
|
|
2146
|
+
* A relative path to an individual endpoint. The field name MUST begin with a forward slash (`/`). The path is **appended** (no relative URL resolution) to the expanded URL from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object `Server Object`}'s `url` field in order to construct the full URL. {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating Path templating} is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use.
|
|
2147
|
+
*/
|
|
2148
|
+
[path: `/${string}`]: PathItemObject;
|
|
2149
|
+
}
|
|
2150
|
+
/**
|
|
2151
|
+
* A simple object to allow referencing other components in the OpenAPI document, internally and externally.
|
|
2152
|
+
*
|
|
2153
|
+
* The `$ref` string value contains a URI {@link https://datatracker.ietf.org/doc/html/rfc3986 RFC3986}, which identifies the location of the value being referenced.
|
|
2154
|
+
*
|
|
2155
|
+
* See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris Relative References}.
|
|
2156
|
+
*
|
|
2157
|
+
* This object cannot be extended with additional properties and any properties added SHALL be ignored.
|
|
2158
|
+
*
|
|
2159
|
+
* Note that this restriction on additional properties is a difference between Reference Objects and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object `Schema Objects`} that contain a `$ref` keyword.
|
|
2160
|
+
*
|
|
2161
|
+
* Reference Object Example
|
|
2162
|
+
*
|
|
2163
|
+
* @example
|
|
2164
|
+
* ```yaml
|
|
2165
|
+
* $ref: '#/components/schemas/Pet'
|
|
2166
|
+
* ```
|
|
2167
|
+
*
|
|
2168
|
+
* Relative Schema Document Example
|
|
2169
|
+
*
|
|
2170
|
+
* @example
|
|
2171
|
+
* ```yaml
|
|
2172
|
+
* $ref: Pet.yaml
|
|
2173
|
+
* ```
|
|
2174
|
+
*
|
|
2175
|
+
* Relative Documents With Embedded Schema Example
|
|
2176
|
+
*
|
|
2177
|
+
* @example
|
|
2178
|
+
* ```yaml
|
|
2179
|
+
* $ref: definitions.yaml#/Pet
|
|
2180
|
+
* ```
|
|
2181
|
+
*/
|
|
2182
|
+
interface ReferenceObject {
|
|
2183
|
+
/**
|
|
2184
|
+
* **REQUIRED**. The reference identifier. This MUST be in the form of a URI.
|
|
2185
|
+
*/
|
|
2186
|
+
$ref: string;
|
|
2187
|
+
/**
|
|
2188
|
+
* A description which by default SHOULD override that of the referenced component. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect.
|
|
2189
|
+
*/
|
|
2190
|
+
description?: string;
|
|
2191
|
+
/**
|
|
2192
|
+
* A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect.
|
|
2193
|
+
*/
|
|
2194
|
+
summary?: string;
|
|
2195
|
+
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Describes a single request body.
|
|
2198
|
+
*
|
|
2199
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2200
|
+
*
|
|
2201
|
+
* **Request Body Examples**
|
|
2202
|
+
*
|
|
2203
|
+
* A request body with a referenced model definition.
|
|
2204
|
+
*
|
|
2205
|
+
* ```yaml
|
|
2206
|
+
* description: user to add to the system
|
|
2207
|
+
* content:
|
|
2208
|
+
* 'application/json':
|
|
2209
|
+
* schema:
|
|
2210
|
+
* $ref: '#/components/schemas/User'
|
|
2211
|
+
* examples:
|
|
2212
|
+
* user:
|
|
2213
|
+
* summary: User Example
|
|
2214
|
+
* externalValue: 'https://foo.bar/examples/user-example.json'
|
|
2215
|
+
* 'application/xml':
|
|
2216
|
+
* schema:
|
|
2217
|
+
* $ref: '#/components/schemas/User'
|
|
2218
|
+
* examples:
|
|
2219
|
+
* user:
|
|
2220
|
+
* summary: User example in XML
|
|
2221
|
+
* externalValue: 'https://foo.bar/examples/user-example.xml'
|
|
2222
|
+
* 'text/plain':
|
|
2223
|
+
* examples:
|
|
2224
|
+
* user:
|
|
2225
|
+
* summary: User example in Plain text
|
|
2226
|
+
* externalValue: 'https://foo.bar/examples/user-example.txt'
|
|
2227
|
+
* '*\/*':
|
|
2228
|
+
* examples:
|
|
2229
|
+
* user:
|
|
2230
|
+
* summary: User example in other format
|
|
2231
|
+
* externalValue: 'https://foo.bar/examples/user-example.whatever'
|
|
2232
|
+
* ```
|
|
2233
|
+
*
|
|
2234
|
+
* A body parameter that is an array of string values:
|
|
2235
|
+
*
|
|
2236
|
+
* ```yaml
|
|
2237
|
+
* description: user to add to the system
|
|
2238
|
+
* required: true
|
|
2239
|
+
* content:
|
|
2240
|
+
* text/plain:
|
|
2241
|
+
* schema:
|
|
2242
|
+
* type: array
|
|
2243
|
+
* items:
|
|
2244
|
+
* type: string
|
|
2245
|
+
* ```
|
|
2246
|
+
*/
|
|
2247
|
+
interface RequestBodyObject {
|
|
2248
|
+
/**
|
|
2249
|
+
* **REQUIRED**. The content of the request body. The key is a media type or {@link https://tools.ietf.org/html/rfc7231#appendix-D media type range} and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
|
|
2250
|
+
*/
|
|
2251
|
+
content: Record<string, MediaTypeObject>;
|
|
2252
|
+
/**
|
|
2253
|
+
* A brief description of the request body. This could contain examples of use. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
2254
|
+
*/
|
|
2255
|
+
description?: string;
|
|
2256
|
+
/**
|
|
2257
|
+
* Determines if the request body is required in the request. Defaults to `false`.
|
|
2258
|
+
*/
|
|
2259
|
+
required?: boolean;
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.
|
|
2263
|
+
*
|
|
2264
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2265
|
+
*
|
|
2266
|
+
* Response of an array of a complex type:
|
|
2267
|
+
*
|
|
2268
|
+
* @example
|
|
2269
|
+
* ```yaml
|
|
2270
|
+
* description: A complex object array response
|
|
2271
|
+
* content:
|
|
2272
|
+
* application/json:
|
|
2273
|
+
* schema:
|
|
2274
|
+
* type: array
|
|
2275
|
+
* items:
|
|
2276
|
+
* $ref: '#/components/schemas/VeryComplexType'
|
|
2277
|
+
* ```
|
|
2278
|
+
*
|
|
2279
|
+
* Response with a string type:
|
|
2280
|
+
*
|
|
2281
|
+
* @example
|
|
2282
|
+
* ```yaml
|
|
2283
|
+
* description: A simple string response
|
|
2284
|
+
* content:
|
|
2285
|
+
* text/plain:
|
|
2286
|
+
* schema:
|
|
2287
|
+
* type: string
|
|
2288
|
+
* ```
|
|
2289
|
+
*
|
|
2290
|
+
* Plain text response with headers:
|
|
2291
|
+
*
|
|
2292
|
+
* @example
|
|
2293
|
+
* ```yaml
|
|
2294
|
+
* description: A simple string response
|
|
2295
|
+
* content:
|
|
2296
|
+
* text/plain:
|
|
2297
|
+
* schema:
|
|
2298
|
+
* type: string
|
|
2299
|
+
* example: 'whoa!'
|
|
2300
|
+
* headers:
|
|
2301
|
+
* X-Rate-Limit-Limit:
|
|
2302
|
+
* description: The number of allowed requests in the current period
|
|
2303
|
+
* schema:
|
|
2304
|
+
* type: integer
|
|
2305
|
+
* X-Rate-Limit-Remaining:
|
|
2306
|
+
* description: The number of remaining requests in the current period
|
|
2307
|
+
* schema:
|
|
2308
|
+
* type: integer
|
|
2309
|
+
* X-Rate-Limit-Reset:
|
|
2310
|
+
* description: The number of seconds left in the current period
|
|
2311
|
+
* schema:
|
|
2312
|
+
* type: integer
|
|
2313
|
+
* ```
|
|
2314
|
+
*
|
|
2315
|
+
* Response with no return value:
|
|
2316
|
+
*
|
|
2317
|
+
* @example
|
|
2318
|
+
* ```yaml
|
|
2319
|
+
* description: object created
|
|
2320
|
+
* ```
|
|
2321
|
+
*/
|
|
2322
|
+
interface ResponseObject {
|
|
2323
|
+
/**
|
|
2324
|
+
* A map containing descriptions of potential response payloads. The key is a media type or {@link https://datatracker.ietf.org/doc/html/rfc7231#appendix-D media type range} and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
|
|
2325
|
+
*/
|
|
2326
|
+
content?: Record<string, MediaTypeObject>;
|
|
2327
|
+
/**
|
|
2328
|
+
* **REQUIRED**. A description of the response. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
2329
|
+
*/
|
|
2330
|
+
description: string;
|
|
2331
|
+
/**
|
|
2332
|
+
* Maps a header name to its definition. {@link https://datatracker.ietf.org/doc/html/rfc7230#page-22 RFC7230} states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored.
|
|
2333
|
+
*/
|
|
2334
|
+
headers?: Record<string, HeaderObject | ReferenceObject>;
|
|
2335
|
+
/**
|
|
2336
|
+
* A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object Component Objects}.
|
|
2337
|
+
*/
|
|
2338
|
+
links?: Record<string, LinkObject | ReferenceObject>;
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.
|
|
2342
|
+
*
|
|
2343
|
+
* The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors.
|
|
2344
|
+
*
|
|
2345
|
+
* The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the `Responses Object`.
|
|
2346
|
+
*
|
|
2347
|
+
* The `Responses Object` MUST contain at least one response code, and if only one response code is provided it SHOULD be the response for a successful operation call.
|
|
2348
|
+
*
|
|
2349
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2350
|
+
*
|
|
2351
|
+
* A 200 response for a successful operation and a default response for others (implying an error):
|
|
2352
|
+
*
|
|
2353
|
+
* @example
|
|
2354
|
+
* ```yaml
|
|
2355
|
+
* '200':
|
|
2356
|
+
* description: a pet to be returned
|
|
2357
|
+
* content:
|
|
2358
|
+
* application/json:
|
|
2359
|
+
* schema:
|
|
2360
|
+
* $ref: '#/components/schemas/Pet'
|
|
2361
|
+
* default:
|
|
2362
|
+
* description: Unexpected error
|
|
2363
|
+
* content:
|
|
2364
|
+
* application/json:
|
|
2365
|
+
* schema:
|
|
2366
|
+
* $ref: '#/components/schemas/ErrorModel'
|
|
2367
|
+
* ```
|
|
2368
|
+
*/
|
|
2369
|
+
interface ResponsesObject {
|
|
2370
|
+
/**
|
|
2371
|
+
* Any {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#http-status-codes HTTP status code} can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
|
|
2372
|
+
*/
|
|
2373
|
+
[statusCode: string]: ResponseObject | ReferenceObject | undefined;
|
|
2374
|
+
/**
|
|
2375
|
+
* The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses.
|
|
2376
|
+
*/
|
|
2377
|
+
default?: ResponseObject | ReferenceObject;
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the {@link https://tools.ietf.org/html/draft-bhutton-json-schema-00 JSON Schema Specification Draft 2020-12}.
|
|
2381
|
+
*
|
|
2382
|
+
* For more information about the properties, see {@link https://tools.ietf.org/html/draft-bhutton-json-schema-00 JSON Schema Core} and {@link https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00 JSON Schema Validation}.
|
|
2383
|
+
*
|
|
2384
|
+
* Unless stated otherwise, the property definitions follow those of JSON Schema and do not add any additional semantics. Where JSON Schema indicates that behavior is defined by the application (e.g. for annotations), OAS also defers the definition of semantics to the application consuming the OpenAPI document.
|
|
2385
|
+
*
|
|
2386
|
+
* **Properties**
|
|
2387
|
+
*
|
|
2388
|
+
* The OpenAPI Schema Object {@link https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-4.3.3 dialect} is defined as requiring the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#fixed-fields-20 OAS base vocabulary}, in addition to the vocabularies as specified in the JSON Schema draft 2020-12 {@link https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8 general purpose meta-schema}.
|
|
2389
|
+
*
|
|
2390
|
+
* The OpenAPI Schema Object dialect for this version of the specification is identified by the URI `https://spec.openapis.org/oas/3.1/dialect/base` (the "OAS dialect schema id").
|
|
2391
|
+
*
|
|
2392
|
+
* The following properties are taken from the JSON Schema specification but their definitions have been extended by the OAS:
|
|
2393
|
+
*
|
|
2394
|
+
* - description - {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
2395
|
+
* - format - See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#dataTypeFormat Data Type Formats} for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats.
|
|
2396
|
+
*
|
|
2397
|
+
* In addition to the JSON Schema properties comprising the OAS dialect, the Schema Object supports keywords from any other vocabularies, or entirely arbitrary properties.
|
|
2398
|
+
*
|
|
2399
|
+
* The OpenAPI Specification's base vocabulary is comprised of the following keywords:
|
|
2400
|
+
*
|
|
2401
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}, though as noted, additional properties MAY omit the `x-` prefix within this object.
|
|
2402
|
+
*/
|
|
2403
|
+
interface SchemaObject {
|
|
2404
|
+
/**
|
|
2405
|
+
* Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#composition-and-inheritance-polymorphism Composition and Inheritance} for more details.
|
|
2406
|
+
*/
|
|
2407
|
+
discriminator?: DiscriminatorObject;
|
|
2408
|
+
/**
|
|
2409
|
+
* A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
|
|
2410
|
+
*
|
|
2411
|
+
* **Deprecated**: The `example` property has been deprecated in favor of the JSON Schema `examples` keyword. Use of `example` is discouraged, and later versions of this specification may remove it.
|
|
2412
|
+
*/
|
|
2413
|
+
example?: unknown;
|
|
2414
|
+
/**
|
|
2415
|
+
* Additional external documentation for this schema.
|
|
2416
|
+
*/
|
|
2417
|
+
externalDocs?: ExternalDocumentationObject;
|
|
2418
|
+
/**
|
|
2419
|
+
* This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
|
|
2420
|
+
*/
|
|
2421
|
+
xml?: XMLObject;
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsSecuritySchemes Security Schemes} under the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object Components Object}.
|
|
2425
|
+
*
|
|
2426
|
+
* Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.
|
|
2427
|
+
*
|
|
2428
|
+
* When a list of Security Requirement Objects is defined on the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object OpenAPI Object} or {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object}, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
|
|
2429
|
+
*
|
|
2430
|
+
* Non-OAuth2 Security Requirement
|
|
2431
|
+
*
|
|
2432
|
+
* @example
|
|
2433
|
+
* ```yaml
|
|
2434
|
+
* api_key: []
|
|
2435
|
+
* ```
|
|
2436
|
+
*
|
|
2437
|
+
* OAuth2 Security Requirement
|
|
2438
|
+
*
|
|
2439
|
+
* @example
|
|
2440
|
+
* ```yaml
|
|
2441
|
+
* petstore_auth:
|
|
2442
|
+
* - write:pets
|
|
2443
|
+
* - read:pets
|
|
2444
|
+
* ```
|
|
2445
|
+
*
|
|
2446
|
+
* Optional OAuth2 Security
|
|
2447
|
+
*
|
|
2448
|
+
* @example
|
|
2449
|
+
* ```yaml
|
|
2450
|
+
* security:
|
|
2451
|
+
* - {}
|
|
2452
|
+
* - petstore_auth:
|
|
2453
|
+
* - write:pets
|
|
2454
|
+
* - read:pets
|
|
2455
|
+
* ```
|
|
2456
|
+
*/
|
|
2457
|
+
interface SecurityRequirementObject {
|
|
2458
|
+
/**
|
|
2459
|
+
* Each name MUST correspond to a security scheme which is declared in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsSecuritySchemes Security Schemes} under the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object Components Object}. If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution, and the list MAY be empty if authorization does not require a specified scope. For other security scheme types, the array MAY contain a list of role names which are required for the execution, but are not otherwise defined or exchanged in-band.
|
|
2460
|
+
*/
|
|
2461
|
+
[name: string]: ReadonlyArray<string>;
|
|
2462
|
+
}
|
|
2463
|
+
/**
|
|
2464
|
+
* Defines a security scheme that can be used by the operations.
|
|
2465
|
+
*
|
|
2466
|
+
* Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, client credentials and authorization code) as defined in {@link https://tools.ietf.org/html/rfc6749 RFC6749}, and {@link https://tools.ietf.org/html/draft-ietf-oauth-discovery-06 OpenID Connect Discovery}. Please note that as of 2020, the implicit flow is about to be deprecated by {@link https://tools.ietf.org/html/draft-ietf-oauth-security-topics OAuth 2.0 Security Best Current Practice}. Recommended for most use case is Authorization Code Grant flow with PKCE.
|
|
2467
|
+
*
|
|
2468
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2469
|
+
*
|
|
2470
|
+
* **Security Scheme Object Example**
|
|
2471
|
+
*
|
|
2472
|
+
* **Basic Authentication Sample**
|
|
2473
|
+
*
|
|
2474
|
+
* ```yaml
|
|
2475
|
+
* type: http
|
|
2476
|
+
* scheme: basic
|
|
2477
|
+
* ```
|
|
2478
|
+
*
|
|
2479
|
+
* **API Key Sample**
|
|
2480
|
+
*
|
|
2481
|
+
* ```yaml
|
|
2482
|
+
* type: apiKey
|
|
2483
|
+
* name: api_key
|
|
2484
|
+
* in: header
|
|
2485
|
+
* ```
|
|
2486
|
+
*
|
|
2487
|
+
* **JWT Bearer Sample**
|
|
2488
|
+
*
|
|
2489
|
+
* ```yaml
|
|
2490
|
+
* type: http
|
|
2491
|
+
* scheme: bearer
|
|
2492
|
+
* bearerFormat: JWT
|
|
2493
|
+
* ```
|
|
2494
|
+
*
|
|
2495
|
+
* **Implicit OAuth2 Sample**
|
|
2496
|
+
*
|
|
2497
|
+
* ```yaml
|
|
2498
|
+
* type: oauth2
|
|
2499
|
+
* flows:
|
|
2500
|
+
* implicit:
|
|
2501
|
+
* authorizationUrl: https://example.com/api/oauth/dialog
|
|
2502
|
+
* scopes:
|
|
2503
|
+
* write:pets: modify pets in your account
|
|
2504
|
+
* read:pets: read your pets
|
|
2505
|
+
* ```
|
|
2506
|
+
*/
|
|
2507
|
+
type SecuritySchemeObject = {
|
|
2508
|
+
/**
|
|
2509
|
+
* A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
2510
|
+
*/
|
|
2511
|
+
description?: string;
|
|
2512
|
+
} & ({
|
|
2513
|
+
/**
|
|
2514
|
+
* **REQUIRED**. The location of the API key. Valid values are "query", "header" or "cookie".
|
|
2515
|
+
*/
|
|
2516
|
+
in: 'cookie' | 'header' | 'query';
|
|
2517
|
+
/**
|
|
2518
|
+
* **REQUIRED**. The name of the header, query or cookie parameter to be used.
|
|
2519
|
+
*/
|
|
2520
|
+
name: string;
|
|
2521
|
+
/**
|
|
2522
|
+
* **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`.
|
|
2523
|
+
*/
|
|
2524
|
+
type: 'apiKey';
|
|
2525
|
+
} | {
|
|
2526
|
+
/**
|
|
2527
|
+
* A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
|
|
2528
|
+
*/
|
|
2529
|
+
bearerFormat?: string;
|
|
2530
|
+
/**
|
|
2531
|
+
* **REQUIRED**. The name of the HTTP Authorization scheme to be used in the {@link https://tools.ietf.org/html/rfc7235#section-5.1 Authorization header as defined in RFC7235}. The values used SHOULD be registered in the {@link https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml IANA Authentication Scheme registry}.
|
|
2532
|
+
*/
|
|
2533
|
+
scheme: string;
|
|
2534
|
+
/**
|
|
2535
|
+
* **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`.
|
|
2536
|
+
*/
|
|
2537
|
+
type: 'http';
|
|
2538
|
+
} | {
|
|
2539
|
+
/**
|
|
2540
|
+
* **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`.
|
|
2541
|
+
*/
|
|
2542
|
+
type: 'mutualTLS';
|
|
2543
|
+
} | {
|
|
2544
|
+
/**
|
|
2545
|
+
* **REQUIRED**. An object containing configuration information for the flow types supported.
|
|
2546
|
+
*/
|
|
2547
|
+
flows: OAuthFlowsObject;
|
|
2548
|
+
/**
|
|
2549
|
+
* **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`.
|
|
2550
|
+
*/
|
|
2551
|
+
type: 'oauth2';
|
|
2552
|
+
} | {
|
|
2553
|
+
/**
|
|
2554
|
+
* **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. The OpenID Connect standard requires the use of TLS.
|
|
2555
|
+
*/
|
|
2556
|
+
openIdConnectUrl: string;
|
|
2557
|
+
/**
|
|
2558
|
+
* **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`.
|
|
2559
|
+
*/
|
|
2560
|
+
type: 'openIdConnect';
|
|
2561
|
+
});
|
|
2562
|
+
/**
|
|
2563
|
+
* An object representing a Server.
|
|
2564
|
+
*
|
|
2565
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2566
|
+
*
|
|
2567
|
+
* @example
|
|
2568
|
+
* ```yaml
|
|
2569
|
+
* url: https://development.gigantic-server.com/v1
|
|
2570
|
+
* description: Development server
|
|
2571
|
+
* ```
|
|
2572
|
+
*/
|
|
2573
|
+
interface ServerObject {
|
|
2574
|
+
/**
|
|
2575
|
+
* An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
2576
|
+
*/
|
|
2577
|
+
description?: string;
|
|
2578
|
+
/**
|
|
2579
|
+
* **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`.
|
|
2580
|
+
*/
|
|
2581
|
+
url: string;
|
|
2582
|
+
/**
|
|
2583
|
+
* A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
|
2584
|
+
*/
|
|
2585
|
+
variables?: Record<string, ServerVariableObject>;
|
|
2586
|
+
}
|
|
2587
|
+
/**
|
|
2588
|
+
* An object representing a Server Variable for server URL template substitution.
|
|
2589
|
+
*
|
|
2590
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2591
|
+
*/
|
|
2592
|
+
interface ServerVariableObject {
|
|
2593
|
+
/**
|
|
2594
|
+
* **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Object's} treatment of default values, because in those cases parameter values are optional. If the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverVariableEnum `enum`} is defined, the value MUST exist in the enum's values.
|
|
2595
|
+
*/
|
|
2596
|
+
default: string;
|
|
2597
|
+
/**
|
|
2598
|
+
* An optional description for the server variable. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
2599
|
+
*/
|
|
2600
|
+
description?: string;
|
|
2601
|
+
/**
|
|
2602
|
+
* An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty.
|
|
2603
|
+
*/
|
|
2604
|
+
enum?: ReadonlyArray<string>;
|
|
2605
|
+
}
|
|
2606
|
+
/**
|
|
2607
|
+
* Adds metadata to a single tag that is used by the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object}. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
|
|
2608
|
+
*
|
|
2609
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2610
|
+
*
|
|
2611
|
+
* @example
|
|
2612
|
+
* ```yaml
|
|
2613
|
+
* name: pet
|
|
2614
|
+
* description: Pets operations
|
|
2615
|
+
* ```
|
|
2616
|
+
*/
|
|
2617
|
+
interface TagObject {
|
|
2618
|
+
/**
|
|
2619
|
+
* A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation.
|
|
2620
|
+
*/
|
|
2621
|
+
description?: string;
|
|
2622
|
+
/**
|
|
2623
|
+
* Additional external documentation for this tag.
|
|
2624
|
+
*/
|
|
2625
|
+
externalDocs?: ExternalDocumentationObject;
|
|
2626
|
+
/**
|
|
2627
|
+
* **REQUIRED**. The name of the tag.
|
|
2628
|
+
*/
|
|
2629
|
+
name: string;
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* A metadata object that allows for more fine-tuned XML model definitions.
|
|
2633
|
+
*
|
|
2634
|
+
* When using arrays, XML element names are _not_ inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.
|
|
2635
|
+
*
|
|
2636
|
+
* This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}.
|
|
2637
|
+
*
|
|
2638
|
+
* **XML Object Examples**
|
|
2639
|
+
*
|
|
2640
|
+
* The examples of the XML object definitions are included inside a property definition of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Object} with a sample of the XML representation of it.
|
|
2641
|
+
*
|
|
2642
|
+
* **No XML Element**
|
|
2643
|
+
*
|
|
2644
|
+
* Basic string property:
|
|
2645
|
+
*
|
|
2646
|
+
* ```yaml
|
|
2647
|
+
* animals:
|
|
2648
|
+
* type: string
|
|
2649
|
+
* ```
|
|
2650
|
+
*
|
|
2651
|
+
* ```xml
|
|
2652
|
+
* <animals>...</animals>
|
|
2653
|
+
* ```
|
|
2654
|
+
*
|
|
2655
|
+
* Basic string array property ({@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xmlWrapped `wrapped`} is `false` by default):
|
|
2656
|
+
*
|
|
2657
|
+
* ```yaml
|
|
2658
|
+
* animals:
|
|
2659
|
+
* type: array
|
|
2660
|
+
* items:
|
|
2661
|
+
* type: string
|
|
2662
|
+
* ```
|
|
2663
|
+
*
|
|
2664
|
+
* ```xml
|
|
2665
|
+
* <animals>...</animals>
|
|
2666
|
+
* <animals>...</animals>
|
|
2667
|
+
* <animals>...</animals>
|
|
2668
|
+
* ```
|
|
2669
|
+
*
|
|
2670
|
+
* **XML Name Replacement**
|
|
2671
|
+
*
|
|
2672
|
+
* ```yaml
|
|
2673
|
+
* animals:
|
|
2674
|
+
* type: string
|
|
2675
|
+
* xml:
|
|
2676
|
+
* name: animal
|
|
2677
|
+
* ```
|
|
2678
|
+
*
|
|
2679
|
+
* ```xml
|
|
2680
|
+
* <animal>...</animal>
|
|
2681
|
+
* ```
|
|
2682
|
+
*
|
|
2683
|
+
* **XML Attribute, Prefix and Namespace**
|
|
2684
|
+
*
|
|
2685
|
+
* In this example, a full model definition is shown.
|
|
2686
|
+
*
|
|
2687
|
+
* ```yaml
|
|
2688
|
+
* Person:
|
|
2689
|
+
* type: object
|
|
2690
|
+
* properties:
|
|
2691
|
+
* id:
|
|
2692
|
+
* type: integer
|
|
2693
|
+
* format: int32
|
|
2694
|
+
* xml:
|
|
2695
|
+
* attribute: true
|
|
2696
|
+
* name:
|
|
2697
|
+
* type: string
|
|
2698
|
+
* xml:
|
|
2699
|
+
* namespace: https://example.com/schema/sample
|
|
2700
|
+
* prefix: sample
|
|
2701
|
+
* ```
|
|
2702
|
+
*
|
|
2703
|
+
* ```xml
|
|
2704
|
+
* <Person id="123">
|
|
2705
|
+
* <sample:name xmlns:sample="https://example.com/schema/sample">example</sample:name>
|
|
2706
|
+
* </Person>
|
|
2707
|
+
* ```
|
|
2708
|
+
*
|
|
2709
|
+
* **XML Arrays**
|
|
2710
|
+
*
|
|
2711
|
+
* Changing the element names:
|
|
2712
|
+
*
|
|
2713
|
+
* ```yaml
|
|
2714
|
+
* animals:
|
|
2715
|
+
* type: array
|
|
2716
|
+
* items:
|
|
2717
|
+
* type: string
|
|
2718
|
+
* xml:
|
|
2719
|
+
* name: animal
|
|
2720
|
+
* ```
|
|
2721
|
+
*
|
|
2722
|
+
* ```xml
|
|
2723
|
+
* <animal>value</animal>
|
|
2724
|
+
* <animal>value</animal>
|
|
2725
|
+
* ```
|
|
2726
|
+
*
|
|
2727
|
+
* The external `name` property has no effect on the XML:
|
|
2728
|
+
*
|
|
2729
|
+
* ```yaml
|
|
2730
|
+
* animals:
|
|
2731
|
+
* type: array
|
|
2732
|
+
* items:
|
|
2733
|
+
* type: string
|
|
2734
|
+
* xml:
|
|
2735
|
+
* name: animal
|
|
2736
|
+
* xml:
|
|
2737
|
+
* name: aliens
|
|
2738
|
+
* ```
|
|
2739
|
+
*
|
|
2740
|
+
* ```xml
|
|
2741
|
+
* <animal>value</animal>
|
|
2742
|
+
* <animal>value</animal>
|
|
2743
|
+
* ```
|
|
2744
|
+
*
|
|
2745
|
+
* Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:
|
|
2746
|
+
*
|
|
2747
|
+
* ```yaml
|
|
2748
|
+
* animals:
|
|
2749
|
+
* type: array
|
|
2750
|
+
* items:
|
|
2751
|
+
* type: string
|
|
2752
|
+
* xml:
|
|
2753
|
+
* wrapped: true
|
|
2754
|
+
* ```
|
|
2755
|
+
*
|
|
2756
|
+
* ```xml
|
|
2757
|
+
* <animals>
|
|
2758
|
+
* <animals>value</animals>
|
|
2759
|
+
* <animals>value</animals>
|
|
2760
|
+
* </animals>
|
|
2761
|
+
* ```
|
|
2762
|
+
*
|
|
2763
|
+
* To overcome the naming problem in the example above, the following definition can be used:
|
|
2764
|
+
*
|
|
2765
|
+
* ```yaml
|
|
2766
|
+
* animals:
|
|
2767
|
+
* type: array
|
|
2768
|
+
* items:
|
|
2769
|
+
* type: string
|
|
2770
|
+
* xml:
|
|
2771
|
+
* name: animal
|
|
2772
|
+
* xml:
|
|
2773
|
+
* wrapped: true
|
|
2774
|
+
* ```
|
|
2775
|
+
*
|
|
2776
|
+
* ```xml
|
|
2777
|
+
* <animals>
|
|
2778
|
+
* <animal>value</animal>
|
|
2779
|
+
* <animal>value</animal>
|
|
2780
|
+
* </animals>
|
|
2781
|
+
* ```
|
|
2782
|
+
*
|
|
2783
|
+
* Affecting both internal and external names:
|
|
2784
|
+
*
|
|
2785
|
+
* ```yaml
|
|
2786
|
+
* animals:
|
|
2787
|
+
* type: array
|
|
2788
|
+
* items:
|
|
2789
|
+
* type: string
|
|
2790
|
+
* xml:
|
|
2791
|
+
* name: animal
|
|
2792
|
+
* xml:
|
|
2793
|
+
* name: aliens
|
|
2794
|
+
* wrapped: true
|
|
2795
|
+
* ```
|
|
2796
|
+
*
|
|
2797
|
+
* ```xml
|
|
2798
|
+
* <aliens>
|
|
2799
|
+
* <animal>value</animal>
|
|
2800
|
+
* <animal>value</animal>
|
|
2801
|
+
* </aliens>
|
|
2802
|
+
* ```
|
|
2803
|
+
*
|
|
2804
|
+
* If we change the external element but not the internal ones:
|
|
2805
|
+
*
|
|
2806
|
+
* ```yaml
|
|
2807
|
+
* animals:
|
|
2808
|
+
* type: array
|
|
2809
|
+
* items:
|
|
2810
|
+
* type: string
|
|
2811
|
+
* xml:
|
|
2812
|
+
* name: aliens
|
|
2813
|
+
* wrapped: true
|
|
2814
|
+
* ```
|
|
2815
|
+
*
|
|
2816
|
+
* ```xml
|
|
2817
|
+
* <aliens>
|
|
2818
|
+
* <aliens>value</aliens>
|
|
2819
|
+
* <aliens>value</aliens>
|
|
2820
|
+
* </aliens>
|
|
2821
|
+
* ```
|
|
2822
|
+
*/
|
|
2823
|
+
interface XMLObject {
|
|
2824
|
+
/**
|
|
2825
|
+
* Declares whether the property definition translates to an attribute instead of an element. Default value is `false`.
|
|
2826
|
+
*/
|
|
2827
|
+
attribute?: boolean;
|
|
2828
|
+
/**
|
|
2829
|
+
* Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored.
|
|
2830
|
+
*/
|
|
2831
|
+
name?: string;
|
|
2832
|
+
/**
|
|
2833
|
+
* The URI of the namespace definition. This MUST be in the form of an absolute URI.
|
|
2834
|
+
*/
|
|
2835
|
+
namespace?: string;
|
|
2836
|
+
/**
|
|
2837
|
+
* The prefix to be used for the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xmlName name}.
|
|
2838
|
+
*/
|
|
2839
|
+
prefix?: string;
|
|
2840
|
+
/**
|
|
2841
|
+
* MAY be used only for an array definition. Signifies whether the array is wrapped (for example, `<books><book/><book/></books>`) or unwrapped (`<book/><book/>`). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`).
|
|
2842
|
+
*/
|
|
2843
|
+
wrapped?: boolean;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
760
2846
|
/**
|
|
761
2847
|
* Generate the OpenAPI client. This method will read the OpenAPI specification and based on the
|
|
762
2848
|
* given language it will generate the client, including the typed models, validation schemas,
|
|
@@ -773,4 +2859,4 @@ declare const _default: {
|
|
|
773
2859
|
defineConfig: (config: UserConfig) => UserConfig;
|
|
774
2860
|
};
|
|
775
2861
|
|
|
776
|
-
export { type UserConfig, createClient, _default as default, defineConfig };
|
|
2862
|
+
export { type OpenApiV3_0_3, type OpenApiV3_1, type UserConfig, createClient, _default as default, defineConfig };
|