@scalar/openapi-types 0.2.1 → 0.2.3
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/CHANGELOG.md +12 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +7 -0
- package/dist/openapi-types.js +28 -33
- package/dist/openapi-types.js.map +7 -0
- package/dist/openapi-types.test-d.js +52 -0
- package/dist/openapi-types.test-d.js.map +7 -0
- package/dist/schemas/3.1/compliance/callback-object.test.js +97 -0
- package/dist/schemas/3.1/compliance/callback-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/contact-object.test.js +19 -0
- package/dist/schemas/3.1/compliance/contact-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/example-object.test.js +91 -0
- package/dist/schemas/3.1/compliance/example-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/external-documentation-object.test.js +17 -0
- package/dist/schemas/3.1/compliance/external-documentation-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/header-object.test.js +47 -0
- package/dist/schemas/3.1/compliance/header-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/info-object.test.js +41 -0
- package/dist/schemas/3.1/compliance/info-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/license-object.test.js +17 -0
- package/dist/schemas/3.1/compliance/license-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/media-type-object.test.js +69 -0
- package/dist/schemas/3.1/compliance/media-type-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/openapi-object.test.js +381 -0
- package/dist/schemas/3.1/compliance/openapi-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/operation-object.test.js +467 -0
- package/dist/schemas/3.1/compliance/operation-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/parameter-object.test.js +155 -0
- package/dist/schemas/3.1/compliance/parameter-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/path-item-object.test.js +103 -0
- package/dist/schemas/3.1/compliance/path-item-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/reference-object.test.js +282 -0
- package/dist/schemas/3.1/compliance/reference-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/request-body-object.test.js +97 -0
- package/dist/schemas/3.1/compliance/request-body-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/response-object.test.js +131 -0
- package/dist/schemas/3.1/compliance/response-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/responses-object.test.js +53 -0
- package/dist/schemas/3.1/compliance/responses-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/runtime-expression.test.js +165 -0
- package/dist/schemas/3.1/compliance/runtime-expression.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/schema-object.test.js +470 -0
- package/dist/schemas/3.1/compliance/schema-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/security-requirement-object.test.js +54 -0
- package/dist/schemas/3.1/compliance/security-requirement-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/security-scheme-object.test.js +123 -0
- package/dist/schemas/3.1/compliance/security-scheme-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/server-object.test.js +17 -0
- package/dist/schemas/3.1/compliance/server-object.test.js.map +7 -0
- package/dist/schemas/3.1/compliance/tag-object.test.js +17 -0
- package/dist/schemas/3.1/compliance/tag-object.test.js.map +7 -0
- package/dist/schemas/3.1/processed/base-path-item-object.js +27 -33
- package/dist/schemas/3.1/processed/base-path-item-object.js.map +7 -0
- package/dist/schemas/3.1/processed/callback-object.js +7 -16
- package/dist/schemas/3.1/processed/callback-object.js.map +7 -0
- package/dist/schemas/3.1/processed/components-object.js +55 -62
- package/dist/schemas/3.1/processed/components-object.js.map +7 -0
- package/dist/schemas/3.1/processed/contact-object.js +11 -17
- package/dist/schemas/3.1/processed/contact-object.js.map +7 -0
- package/dist/schemas/3.1/processed/discriminator-object.js +15 -26
- package/dist/schemas/3.1/processed/discriminator-object.js.map +7 -0
- package/dist/schemas/3.1/processed/encoding-object.js +17 -28
- package/dist/schemas/3.1/processed/encoding-object.js.map +7 -0
- package/dist/schemas/3.1/processed/example-object.js +23 -33
- package/dist/schemas/3.1/processed/example-object.js.map +7 -0
- package/dist/schemas/3.1/processed/external-documentation-object.js +9 -15
- package/dist/schemas/3.1/processed/external-documentation-object.js.map +7 -0
- package/dist/schemas/3.1/processed/header-object.js +48 -64
- package/dist/schemas/3.1/processed/header-object.js.map +7 -0
- package/dist/schemas/3.1/processed/index.js +87 -30
- package/dist/schemas/3.1/processed/index.js.map +7 -0
- package/dist/schemas/3.1/processed/info-object.js +36 -43
- package/dist/schemas/3.1/processed/info-object.js.map +7 -0
- package/dist/schemas/3.1/processed/license-object.js +13 -19
- package/dist/schemas/3.1/processed/license-object.js.map +7 -0
- package/dist/schemas/3.1/processed/link-object.js +36 -50
- package/dist/schemas/3.1/processed/link-object.js.map +7 -0
- package/dist/schemas/3.1/processed/media-type-object-without-encoding.js +26 -32
- package/dist/schemas/3.1/processed/media-type-object-without-encoding.js.map +7 -0
- package/dist/schemas/3.1/processed/media-type-object.js +30 -36
- package/dist/schemas/3.1/processed/media-type-object.js.map +7 -0
- package/dist/schemas/3.1/processed/openapi-object.js +70 -78
- package/dist/schemas/3.1/processed/openapi-object.js.map +7 -0
- package/dist/schemas/3.1/processed/operation-object-without-callbacks.js +64 -70
- package/dist/schemas/3.1/processed/operation-object-without-callbacks.js.map +7 -0
- package/dist/schemas/3.1/processed/operation-object.js +14 -20
- package/dist/schemas/3.1/processed/operation-object.js.map +7 -0
- package/dist/schemas/3.1/processed/parameter-object.js +83 -91
- package/dist/schemas/3.1/processed/parameter-object.js.map +7 -0
- package/dist/schemas/3.1/processed/path-item-object-without-callbacks.js +38 -46
- package/dist/schemas/3.1/processed/path-item-object-without-callbacks.js.map +7 -0
- package/dist/schemas/3.1/processed/path-item-object.js +38 -46
- package/dist/schemas/3.1/processed/path-item-object.js.map +7 -0
- package/dist/schemas/3.1/processed/paths-object.js +16 -22
- package/dist/schemas/3.1/processed/paths-object.js.map +7 -0
- package/dist/schemas/3.1/processed/request-body-object.js +25 -31
- package/dist/schemas/3.1/processed/request-body-object.js.map +7 -0
- package/dist/schemas/3.1/processed/response-object.js +28 -34
- package/dist/schemas/3.1/processed/response-object.js.map +7 -0
- package/dist/schemas/3.1/processed/responses-object.js +17 -30
- package/dist/schemas/3.1/processed/responses-object.js.map +7 -0
- package/dist/schemas/3.1/processed/runtime-expression.js +50 -81
- package/dist/schemas/3.1/processed/runtime-expression.js.map +7 -0
- package/dist/schemas/3.1/processed/schema-object.js +88 -89
- package/dist/schemas/3.1/processed/schema-object.js.map +7 -0
- package/dist/schemas/3.1/processed/schema-object.test.js +310 -0
- package/dist/schemas/3.1/processed/schema-object.test.js.map +7 -0
- package/dist/schemas/3.1/processed/security-requirement-object.js +20 -36
- package/dist/schemas/3.1/processed/security-requirement-object.js.map +7 -0
- package/dist/schemas/3.1/processed/security-scheme-object.js +114 -142
- package/dist/schemas/3.1/processed/security-scheme-object.js.map +7 -0
- package/dist/schemas/3.1/processed/server-object.js +19 -25
- package/dist/schemas/3.1/processed/server-object.js.map +7 -0
- package/dist/schemas/3.1/processed/server-variable-object.js +19 -25
- package/dist/schemas/3.1/processed/server-variable-object.js.map +7 -0
- package/dist/schemas/3.1/processed/tag-object.js +12 -19
- package/dist/schemas/3.1/processed/tag-object.js.map +7 -0
- package/dist/schemas/3.1/processed/webhooks-object.js +6 -18
- package/dist/schemas/3.1/processed/webhooks-object.js.map +7 -0
- package/dist/schemas/3.1/processed/xml-object.js +28 -38
- package/dist/schemas/3.1/processed/xml-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/base-path-item-object.js +16 -22
- package/dist/schemas/3.1/unprocessed/base-path-item-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/callback-object.js +6 -15
- package/dist/schemas/3.1/unprocessed/callback-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/components-object.js +58 -65
- package/dist/schemas/3.1/unprocessed/components-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/contact-object.js +6 -12
- package/dist/schemas/3.1/unprocessed/contact-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/discriminator-object.js +6 -17
- package/dist/schemas/3.1/unprocessed/discriminator-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/encoding-object.js +14 -25
- package/dist/schemas/3.1/unprocessed/encoding-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/example-object.js +6 -16
- package/dist/schemas/3.1/unprocessed/example-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/external-documentation-object.js +6 -12
- package/dist/schemas/3.1/unprocessed/external-documentation-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/header-object.js +25 -41
- package/dist/schemas/3.1/unprocessed/header-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/index.js +89 -31
- package/dist/schemas/3.1/unprocessed/index.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/info-object.js +6 -13
- package/dist/schemas/3.1/unprocessed/info-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/license-object.js +6 -12
- package/dist/schemas/3.1/unprocessed/license-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/link-object.js +6 -20
- package/dist/schemas/3.1/unprocessed/link-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/media-type-object-without-encoding.js +6 -12
- package/dist/schemas/3.1/unprocessed/media-type-object-without-encoding.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/media-type-object.js +33 -39
- package/dist/schemas/3.1/unprocessed/media-type-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/openapi-object.js +6 -12
- package/dist/schemas/3.1/unprocessed/openapi-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/operation-object-without-callbacks.js +38 -44
- package/dist/schemas/3.1/unprocessed/operation-object-without-callbacks.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/operation-object.js +15 -21
- package/dist/schemas/3.1/unprocessed/operation-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/parameter-object.js +22 -30
- package/dist/schemas/3.1/unprocessed/parameter-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/path-item-object-without-callbacks.js +38 -46
- package/dist/schemas/3.1/unprocessed/path-item-object-without-callbacks.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/path-item-object.js +52 -60
- package/dist/schemas/3.1/unprocessed/path-item-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/paths-object.js +6 -14
- package/dist/schemas/3.1/unprocessed/paths-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/reference-object.js +20 -28
- package/dist/schemas/3.1/unprocessed/reference-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/request-body-object.js +6 -12
- package/dist/schemas/3.1/unprocessed/request-body-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/response-object.js +27 -33
- package/dist/schemas/3.1/unprocessed/response-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/responses-object.js +18 -31
- package/dist/schemas/3.1/unprocessed/responses-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/runtime-expression.js +6 -17
- package/dist/schemas/3.1/unprocessed/runtime-expression.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/schema-object.js +31 -32
- package/dist/schemas/3.1/unprocessed/schema-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/security-requirement-object.js +6 -23
- package/dist/schemas/3.1/unprocessed/security-requirement-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/security-scheme-object.js +41 -29
- package/dist/schemas/3.1/unprocessed/security-scheme-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/server-object.js +6 -12
- package/dist/schemas/3.1/unprocessed/server-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/server-variable-object.js +6 -12
- package/dist/schemas/3.1/unprocessed/server-variable-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/tag-object.js +6 -13
- package/dist/schemas/3.1/unprocessed/tag-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/webhooks-object.js +6 -18
- package/dist/schemas/3.1/unprocessed/webhooks-object.js.map +7 -0
- package/dist/schemas/3.1/unprocessed/xml-object.js +6 -16
- package/dist/schemas/3.1/unprocessed/xml-object.js.map +7 -0
- package/dist/schemas/extensions/index.d.ts +1 -0
- package/dist/schemas/extensions/index.d.ts.map +1 -1
- package/dist/schemas/extensions/index.js +31 -11
- package/dist/schemas/extensions/index.js.map +7 -0
- package/dist/schemas/extensions/x-additional-properties-name.js +6 -12
- package/dist/schemas/extensions/x-additional-properties-name.js.map +7 -0
- package/dist/schemas/extensions/x-additional-properties-name.test.js +28 -0
- package/dist/schemas/extensions/x-additional-properties-name.test.js.map +7 -0
- package/dist/schemas/extensions/x-code-samples.js +12 -10
- package/dist/schemas/extensions/x-code-samples.js.map +7 -0
- package/dist/schemas/extensions/x-code-samples.test.js +82 -0
- package/dist/schemas/extensions/x-code-samples.test.js.map +7 -0
- package/dist/schemas/extensions/x-display-name.js +8 -0
- package/dist/schemas/extensions/x-display-name.js.map +7 -0
- package/dist/schemas/extensions/x-display-name.test.js +28 -0
- package/dist/schemas/extensions/x-display-name.test.js.map +7 -0
- package/dist/schemas/extensions/x-enum-descriptions.js +6 -18
- package/dist/schemas/extensions/x-enum-descriptions.js.map +7 -0
- package/dist/schemas/extensions/x-enum-descriptions.test.js +36 -0
- package/dist/schemas/extensions/x-enum-descriptions.test.js.map +7 -0
- package/dist/schemas/extensions/x-internal.js +6 -5
- package/dist/schemas/extensions/x-internal.js.map +7 -0
- package/dist/schemas/extensions/x-internal.test.js +20 -0
- package/dist/schemas/extensions/x-internal.test.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-icon.js +6 -5
- package/dist/schemas/extensions/x-scalar-icon.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-icon.test.js +14 -0
- package/dist/schemas/extensions/x-scalar-icon.test.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-ignore.js +6 -5
- package/dist/schemas/extensions/x-scalar-ignore.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-ignore.test.js +20 -0
- package/dist/schemas/extensions/x-scalar-ignore.test.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-redirect-uri.js +6 -5
- package/dist/schemas/extensions/x-scalar-redirect-uri.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-redirect-uri.test.js +23 -0
- package/dist/schemas/extensions/x-scalar-redirect-uri.test.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-sdk-installation.js +10 -13
- package/dist/schemas/extensions/x-scalar-sdk-installation.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-sdk-installation.test.js +25 -0
- package/dist/schemas/extensions/x-scalar-sdk-installation.test.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-security-query.d.ts +20 -0
- package/dist/schemas/extensions/x-scalar-security-query.d.ts.map +1 -0
- package/dist/schemas/extensions/x-scalar-security-query.js +8 -0
- package/dist/schemas/extensions/x-scalar-security-query.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-security-query.test.js +35 -0
- package/dist/schemas/extensions/x-scalar-security-query.test.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-stability.js +10 -19
- package/dist/schemas/extensions/x-scalar-stability.js.map +7 -0
- package/dist/schemas/extensions/x-scalar-stability.test.js +33 -0
- package/dist/schemas/extensions/x-scalar-stability.test.js.map +7 -0
- package/dist/schemas/extensions/x-tag-groups.js +14 -17
- package/dist/schemas/extensions/x-tag-groups.js.map +7 -0
- package/dist/schemas/extensions/x-tag-groups.test.js +55 -0
- package/dist/schemas/extensions/x-tag-groups.test.js.map +7 -0
- package/dist/schemas/extensions/x-use-pkce.js +11 -10
- package/dist/schemas/extensions/x-use-pkce.js.map +7 -0
- package/dist/schemas/extensions/x-use-pkce.test.js +34 -0
- package/dist/schemas/extensions/x-use-pkce.test.js.map +7 -0
- package/package.json +4 -5
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { LicenseObjectSchema } from "../unprocessed/license-object.js";
|
|
3
|
+
describe("license-object", () => {
|
|
4
|
+
describe("LicenseObjectSchema", () => {
|
|
5
|
+
it("License Object Example", () => {
|
|
6
|
+
const result = LicenseObjectSchema.parse({
|
|
7
|
+
name: "Apache 2.0",
|
|
8
|
+
identifier: "Apache-2.0"
|
|
9
|
+
});
|
|
10
|
+
expect(result).toEqual({
|
|
11
|
+
name: "Apache 2.0",
|
|
12
|
+
identifier: "Apache-2.0"
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=license-object.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/schemas/3.1/compliance/license-object.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { LicenseObjectSchema } from '../unprocessed/license-object'\n\ndescribe('license-object', () => {\n describe('LicenseObjectSchema', () => {\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#license-object-example\n it('License Object Example', () => {\n const result = LicenseObjectSchema.parse({\n name: 'Apache 2.0',\n identifier: 'Apache-2.0',\n })\n\n expect(result).toEqual({\n name: 'Apache 2.0',\n identifier: 'Apache-2.0',\n })\n })\n })\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,2BAA2B;AAEpC,SAAS,kBAAkB,MAAM;AAC/B,WAAS,uBAAuB,MAAM;AAEpC,OAAG,0BAA0B,MAAM;AACjC,YAAM,SAAS,oBAAoB,MAAM;AAAA,QACvC,MAAM;AAAA,QACN,YAAY;AAAA,MACd,CAAC;AAED,aAAO,MAAM,EAAE,QAAQ;AAAA,QACrB,MAAM;AAAA,QACN,YAAY;AAAA,MACd,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { MediaTypeObjectSchema } from "../unprocessed/media-type-object.js";
|
|
3
|
+
describe("media-type-object", () => {
|
|
4
|
+
describe("MediaTypeObject", () => {
|
|
5
|
+
it("Media Type Examples", () => {
|
|
6
|
+
const result = MediaTypeObjectSchema.parse({
|
|
7
|
+
schema: {
|
|
8
|
+
$ref: "#/components/schemas/Pet"
|
|
9
|
+
},
|
|
10
|
+
examples: {
|
|
11
|
+
cat: {
|
|
12
|
+
summary: "An example of a cat",
|
|
13
|
+
value: {
|
|
14
|
+
name: "Fluffy",
|
|
15
|
+
petType: "Cat",
|
|
16
|
+
color: "White",
|
|
17
|
+
gender: "male",
|
|
18
|
+
breed: "Persian"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
dog: {
|
|
22
|
+
summary: "An example of a dog with a cat's name",
|
|
23
|
+
value: {
|
|
24
|
+
name: "Puma",
|
|
25
|
+
petType: "Dog",
|
|
26
|
+
color: "Black",
|
|
27
|
+
gender: "Female",
|
|
28
|
+
breed: "Mixed"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
frog: {
|
|
32
|
+
$ref: "#/components/examples/frog-example"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
expect(result).toEqual({
|
|
37
|
+
schema: {
|
|
38
|
+
$ref: "#/components/schemas/Pet"
|
|
39
|
+
},
|
|
40
|
+
examples: {
|
|
41
|
+
cat: {
|
|
42
|
+
summary: "An example of a cat",
|
|
43
|
+
value: {
|
|
44
|
+
name: "Fluffy",
|
|
45
|
+
petType: "Cat",
|
|
46
|
+
color: "White",
|
|
47
|
+
gender: "male",
|
|
48
|
+
breed: "Persian"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
dog: {
|
|
52
|
+
summary: "An example of a dog with a cat's name",
|
|
53
|
+
value: {
|
|
54
|
+
name: "Puma",
|
|
55
|
+
petType: "Dog",
|
|
56
|
+
color: "Black",
|
|
57
|
+
gender: "Female",
|
|
58
|
+
breed: "Mixed"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
frog: {
|
|
62
|
+
$ref: "#/components/examples/frog-example"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=media-type-object.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/schemas/3.1/compliance/media-type-object.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { MediaTypeObjectSchema } from '../unprocessed/media-type-object'\n\ndescribe('media-type-object', () => {\n describe('MediaTypeObject', () => {\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#media-type-examples\n it('Media Type Examples', () => {\n const result = MediaTypeObjectSchema.parse({\n schema: {\n $ref: '#/components/schemas/Pet',\n },\n examples: {\n cat: {\n summary: 'An example of a cat',\n value: {\n name: 'Fluffy',\n petType: 'Cat',\n color: 'White',\n gender: 'male',\n breed: 'Persian',\n },\n },\n dog: {\n summary: \"An example of a dog with a cat's name\",\n value: {\n name: 'Puma',\n petType: 'Dog',\n color: 'Black',\n gender: 'Female',\n breed: 'Mixed',\n },\n },\n frog: {\n $ref: '#/components/examples/frog-example',\n },\n },\n })\n\n expect(result).toEqual({\n schema: {\n $ref: '#/components/schemas/Pet',\n },\n examples: {\n cat: {\n summary: 'An example of a cat',\n value: {\n name: 'Fluffy',\n petType: 'Cat',\n color: 'White',\n gender: 'male',\n breed: 'Persian',\n },\n },\n dog: {\n summary: \"An example of a dog with a cat's name\",\n value: {\n name: 'Puma',\n petType: 'Dog',\n color: 'Black',\n gender: 'Female',\n breed: 'Mixed',\n },\n },\n frog: {\n $ref: '#/components/examples/frog-example',\n },\n },\n })\n })\n })\n})\n"],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
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { OpenApiObjectSchema } from "../unprocessed/openapi-object.js";
|
|
3
|
+
describe("openapi-object", () => {
|
|
4
|
+
describe("OpenApiObject", () => {
|
|
5
|
+
describe("Server Object Example", () => {
|
|
6
|
+
it(`The following shows how multiple servers can be described, for example, at the OpenAPI Object's servers`, () => {
|
|
7
|
+
const result = OpenApiObjectSchema.parse({
|
|
8
|
+
openapi: "3.1.1",
|
|
9
|
+
info: {
|
|
10
|
+
title: "Example",
|
|
11
|
+
version: "1.0.0"
|
|
12
|
+
},
|
|
13
|
+
servers: [
|
|
14
|
+
{
|
|
15
|
+
url: "https://development.gigantic-server.com/v1",
|
|
16
|
+
description: "Development server"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
url: "https://staging.gigantic-server.com/v1",
|
|
20
|
+
description: "Staging server"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
url: "https://api.gigantic-server.com/v1",
|
|
24
|
+
description: "Production server"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
expect(result).toEqual({
|
|
29
|
+
openapi: "3.1.1",
|
|
30
|
+
info: {
|
|
31
|
+
title: "Example",
|
|
32
|
+
version: "1.0.0"
|
|
33
|
+
},
|
|
34
|
+
servers: [
|
|
35
|
+
{
|
|
36
|
+
url: "https://development.gigantic-server.com/v1",
|
|
37
|
+
description: "Development server"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
url: "https://staging.gigantic-server.com/v1",
|
|
41
|
+
description: "Staging server"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
url: "https://api.gigantic-server.com/v1",
|
|
45
|
+
description: "Production server"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
it("The following shows how variables can be used for a server configuration", () => {
|
|
52
|
+
const result = OpenApiObjectSchema.parse({
|
|
53
|
+
openapi: "3.1.1",
|
|
54
|
+
info: {
|
|
55
|
+
title: "Example",
|
|
56
|
+
version: "1.0.0"
|
|
57
|
+
},
|
|
58
|
+
servers: [
|
|
59
|
+
{
|
|
60
|
+
"url": "https://{username}.gigantic-server.com:{port}/{basePath}",
|
|
61
|
+
"description": "The production API server",
|
|
62
|
+
"variables": {
|
|
63
|
+
"username": {
|
|
64
|
+
"default": "demo",
|
|
65
|
+
"description": "A user-specific subdomain. Use `demo` for a free sandbox environment."
|
|
66
|
+
},
|
|
67
|
+
port: {
|
|
68
|
+
enum: ["8443", "443"],
|
|
69
|
+
default: "8443"
|
|
70
|
+
},
|
|
71
|
+
"basePath": {
|
|
72
|
+
"default": "v2"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
expect(result).toEqual({
|
|
79
|
+
openapi: "3.1.1",
|
|
80
|
+
info: {
|
|
81
|
+
title: "Example",
|
|
82
|
+
version: "1.0.0"
|
|
83
|
+
},
|
|
84
|
+
servers: [
|
|
85
|
+
{
|
|
86
|
+
url: "https://{username}.gigantic-server.com:{port}/{basePath}",
|
|
87
|
+
description: "The production API server",
|
|
88
|
+
variables: {
|
|
89
|
+
username: {
|
|
90
|
+
default: "demo",
|
|
91
|
+
description: "A user-specific subdomain. Use `demo` for a free sandbox environment."
|
|
92
|
+
},
|
|
93
|
+
port: {
|
|
94
|
+
enum: ["8443", "443"],
|
|
95
|
+
default: "8443"
|
|
96
|
+
},
|
|
97
|
+
basePath: {
|
|
98
|
+
default: "v2"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
it("Components Object Example", () => {
|
|
106
|
+
const result = OpenApiObjectSchema.parse({
|
|
107
|
+
openapi: "3.1.1",
|
|
108
|
+
info: {
|
|
109
|
+
title: "Example",
|
|
110
|
+
version: "1.0.0"
|
|
111
|
+
},
|
|
112
|
+
components: {
|
|
113
|
+
schemas: {
|
|
114
|
+
GeneralError: {
|
|
115
|
+
type: "object",
|
|
116
|
+
properties: {
|
|
117
|
+
code: {
|
|
118
|
+
type: "integer",
|
|
119
|
+
format: "int32"
|
|
120
|
+
},
|
|
121
|
+
message: {
|
|
122
|
+
type: "string"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
Category: {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: {
|
|
129
|
+
id: {
|
|
130
|
+
type: "integer",
|
|
131
|
+
format: "int64"
|
|
132
|
+
},
|
|
133
|
+
name: {
|
|
134
|
+
type: "string"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
Tag: {
|
|
139
|
+
type: "object",
|
|
140
|
+
properties: {
|
|
141
|
+
id: {
|
|
142
|
+
type: "integer",
|
|
143
|
+
format: "int64"
|
|
144
|
+
},
|
|
145
|
+
name: {
|
|
146
|
+
type: "string"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
parameters: {
|
|
152
|
+
skipParam: {
|
|
153
|
+
name: "skip",
|
|
154
|
+
in: "query",
|
|
155
|
+
description: "number of items to skip",
|
|
156
|
+
required: true,
|
|
157
|
+
schema: {
|
|
158
|
+
type: "integer",
|
|
159
|
+
format: "int32"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
limitParam: {
|
|
163
|
+
name: "limit",
|
|
164
|
+
in: "query",
|
|
165
|
+
description: "max records to return",
|
|
166
|
+
required: true,
|
|
167
|
+
schema: {
|
|
168
|
+
type: "integer",
|
|
169
|
+
format: "int32"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
responses: {
|
|
174
|
+
NotFound: {
|
|
175
|
+
description: "Entity not found."
|
|
176
|
+
},
|
|
177
|
+
IllegalInput: {
|
|
178
|
+
description: "Illegal input for operation."
|
|
179
|
+
},
|
|
180
|
+
GeneralError: {
|
|
181
|
+
description: "General Error",
|
|
182
|
+
content: {
|
|
183
|
+
"application/json": {
|
|
184
|
+
schema: {
|
|
185
|
+
$ref: "#/components/schemas/GeneralError"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
securitySchemes: {
|
|
192
|
+
api_key: {
|
|
193
|
+
type: "apiKey",
|
|
194
|
+
name: "api-key",
|
|
195
|
+
in: "header"
|
|
196
|
+
},
|
|
197
|
+
petstore_auth: {
|
|
198
|
+
type: "oauth2",
|
|
199
|
+
flows: {
|
|
200
|
+
implicit: {
|
|
201
|
+
authorizationUrl: "https://example.org/api/oauth/dialog",
|
|
202
|
+
scopes: {
|
|
203
|
+
"write:pets": "modify pets in your account",
|
|
204
|
+
"read:pets": "read your pets"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
expect(result).toEqual({
|
|
213
|
+
openapi: "3.1.1",
|
|
214
|
+
info: {
|
|
215
|
+
title: "Example",
|
|
216
|
+
version: "1.0.0"
|
|
217
|
+
},
|
|
218
|
+
components: {
|
|
219
|
+
schemas: {
|
|
220
|
+
GeneralError: {
|
|
221
|
+
type: "object",
|
|
222
|
+
properties: {
|
|
223
|
+
code: {
|
|
224
|
+
type: "integer",
|
|
225
|
+
format: "int32"
|
|
226
|
+
},
|
|
227
|
+
message: {
|
|
228
|
+
type: "string"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
Category: {
|
|
233
|
+
type: "object",
|
|
234
|
+
properties: {
|
|
235
|
+
id: {
|
|
236
|
+
type: "integer",
|
|
237
|
+
format: "int64"
|
|
238
|
+
},
|
|
239
|
+
name: {
|
|
240
|
+
type: "string"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
Tag: {
|
|
245
|
+
type: "object",
|
|
246
|
+
properties: {
|
|
247
|
+
id: {
|
|
248
|
+
type: "integer",
|
|
249
|
+
format: "int64"
|
|
250
|
+
},
|
|
251
|
+
name: {
|
|
252
|
+
type: "string"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
parameters: {
|
|
258
|
+
skipParam: {
|
|
259
|
+
name: "skip",
|
|
260
|
+
in: "query",
|
|
261
|
+
description: "number of items to skip",
|
|
262
|
+
required: true,
|
|
263
|
+
schema: {
|
|
264
|
+
type: "integer",
|
|
265
|
+
format: "int32"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
limitParam: {
|
|
269
|
+
name: "limit",
|
|
270
|
+
in: "query",
|
|
271
|
+
description: "max records to return",
|
|
272
|
+
required: true,
|
|
273
|
+
schema: {
|
|
274
|
+
type: "integer",
|
|
275
|
+
format: "int32"
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
responses: {
|
|
280
|
+
NotFound: {
|
|
281
|
+
description: "Entity not found."
|
|
282
|
+
},
|
|
283
|
+
IllegalInput: {
|
|
284
|
+
description: "Illegal input for operation."
|
|
285
|
+
},
|
|
286
|
+
GeneralError: {
|
|
287
|
+
description: "General Error",
|
|
288
|
+
content: {
|
|
289
|
+
"application/json": {
|
|
290
|
+
schema: {
|
|
291
|
+
$ref: "#/components/schemas/GeneralError"
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
securitySchemes: {
|
|
298
|
+
api_key: {
|
|
299
|
+
type: "apiKey",
|
|
300
|
+
name: "api-key",
|
|
301
|
+
in: "header"
|
|
302
|
+
},
|
|
303
|
+
petstore_auth: {
|
|
304
|
+
type: "oauth2",
|
|
305
|
+
flows: {
|
|
306
|
+
implicit: {
|
|
307
|
+
authorizationUrl: "https://example.org/api/oauth/dialog",
|
|
308
|
+
scopes: {
|
|
309
|
+
"write:pets": "modify pets in your account",
|
|
310
|
+
"read:pets": "read your pets"
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
it("Paths Object Example", () => {
|
|
320
|
+
const result = OpenApiObjectSchema.parse({
|
|
321
|
+
openapi: "3.1.1",
|
|
322
|
+
info: {
|
|
323
|
+
title: "Example",
|
|
324
|
+
version: "1.0.0"
|
|
325
|
+
},
|
|
326
|
+
paths: {
|
|
327
|
+
"/pets": {
|
|
328
|
+
get: {
|
|
329
|
+
description: "Returns all pets from the system that the user has access to",
|
|
330
|
+
responses: {
|
|
331
|
+
200: {
|
|
332
|
+
description: "A list of pets.",
|
|
333
|
+
content: {
|
|
334
|
+
"application/json": {
|
|
335
|
+
schema: {
|
|
336
|
+
type: "array",
|
|
337
|
+
items: {
|
|
338
|
+
$ref: "#/components/schemas/pet"
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
expect(result).toEqual({
|
|
350
|
+
openapi: "3.1.1",
|
|
351
|
+
info: {
|
|
352
|
+
title: "Example",
|
|
353
|
+
version: "1.0.0"
|
|
354
|
+
},
|
|
355
|
+
paths: {
|
|
356
|
+
"/pets": {
|
|
357
|
+
get: {
|
|
358
|
+
description: "Returns all pets from the system that the user has access to",
|
|
359
|
+
responses: {
|
|
360
|
+
200: {
|
|
361
|
+
description: "A list of pets.",
|
|
362
|
+
content: {
|
|
363
|
+
"application/json": {
|
|
364
|
+
schema: {
|
|
365
|
+
type: "array",
|
|
366
|
+
items: {
|
|
367
|
+
$ref: "#/components/schemas/pet"
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
//# sourceMappingURL=openapi-object.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/schemas/3.1/compliance/openapi-object.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { OpenApiObjectSchema } from '../unprocessed/openapi-object'\n\ndescribe('openapi-object', () => {\n describe('OpenApiObject', () => {\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-object-example\n describe('Server Object Example', () => {\n it(`The following shows how multiple servers can be described, for example, at the OpenAPI Object's servers`, () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n servers: [\n {\n url: 'https://development.gigantic-server.com/v1',\n description: 'Development server',\n },\n {\n url: 'https://staging.gigantic-server.com/v1',\n description: 'Staging server',\n },\n {\n url: 'https://api.gigantic-server.com/v1',\n description: 'Production server',\n },\n ],\n })\n\n expect(result).toEqual({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n servers: [\n {\n url: 'https://development.gigantic-server.com/v1',\n description: 'Development server',\n },\n {\n url: 'https://staging.gigantic-server.com/v1',\n description: 'Staging server',\n },\n {\n url: 'https://api.gigantic-server.com/v1',\n description: 'Production server',\n },\n ],\n })\n })\n })\n\n it('The following shows how variables can be used for a server configuration', () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n servers: [\n {\n 'url': 'https://{username}.gigantic-server.com:{port}/{basePath}',\n 'description': 'The production API server',\n 'variables': {\n 'username': {\n 'default': 'demo',\n 'description': 'A user-specific subdomain. Use `demo` for a free sandbox environment.',\n },\n port: {\n enum: ['8443', '443'],\n default: '8443',\n },\n 'basePath': {\n 'default': 'v2',\n },\n },\n },\n ],\n })\n\n expect(result).toEqual({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n servers: [\n {\n url: 'https://{username}.gigantic-server.com:{port}/{basePath}',\n description: 'The production API server',\n variables: {\n username: {\n default: 'demo',\n description: 'A user-specific subdomain. Use `demo` for a free sandbox environment.',\n },\n port: {\n enum: ['8443', '443'],\n default: '8443',\n },\n basePath: {\n default: 'v2',\n },\n },\n },\n ],\n })\n })\n\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#components-object-example\n it('Components Object Example', () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n components: {\n schemas: {\n GeneralError: {\n type: 'object',\n properties: {\n code: {\n type: 'integer',\n format: 'int32',\n },\n message: {\n type: 'string',\n },\n },\n },\n Category: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n },\n Tag: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n },\n },\n parameters: {\n skipParam: {\n name: 'skip',\n in: 'query',\n description: 'number of items to skip',\n required: true,\n schema: {\n type: 'integer',\n format: 'int32',\n },\n },\n limitParam: {\n name: 'limit',\n in: 'query',\n description: 'max records to return',\n required: true,\n schema: {\n type: 'integer',\n format: 'int32',\n },\n },\n },\n responses: {\n NotFound: {\n description: 'Entity not found.',\n },\n IllegalInput: {\n description: 'Illegal input for operation.',\n },\n GeneralError: {\n description: 'General Error',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/GeneralError',\n },\n },\n },\n },\n },\n securitySchemes: {\n api_key: {\n type: 'apiKey',\n name: 'api-key',\n in: 'header',\n },\n petstore_auth: {\n type: 'oauth2',\n flows: {\n implicit: {\n authorizationUrl: 'https://example.org/api/oauth/dialog',\n scopes: {\n 'write:pets': 'modify pets in your account',\n 'read:pets': 'read your pets',\n },\n },\n },\n },\n },\n },\n })\n\n expect(result).toEqual({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n components: {\n schemas: {\n GeneralError: {\n type: 'object',\n properties: {\n code: {\n type: 'integer',\n format: 'int32',\n },\n message: {\n type: 'string',\n },\n },\n },\n Category: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n },\n Tag: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n },\n },\n parameters: {\n skipParam: {\n name: 'skip',\n in: 'query',\n description: 'number of items to skip',\n required: true,\n schema: {\n type: 'integer',\n format: 'int32',\n },\n },\n limitParam: {\n name: 'limit',\n in: 'query',\n description: 'max records to return',\n required: true,\n schema: {\n type: 'integer',\n format: 'int32',\n },\n },\n },\n responses: {\n NotFound: {\n description: 'Entity not found.',\n },\n IllegalInput: {\n description: 'Illegal input for operation.',\n },\n GeneralError: {\n description: 'General Error',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/GeneralError',\n },\n },\n },\n },\n },\n securitySchemes: {\n api_key: {\n type: 'apiKey',\n name: 'api-key',\n in: 'header',\n },\n petstore_auth: {\n type: 'oauth2',\n flows: {\n implicit: {\n authorizationUrl: 'https://example.org/api/oauth/dialog',\n scopes: {\n 'write:pets': 'modify pets in your account',\n 'read:pets': 'read your pets',\n },\n },\n },\n },\n },\n },\n })\n })\n\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#paths-object-example\n it('Paths Object Example', () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n paths: {\n '/pets': {\n get: {\n description: 'Returns all pets from the system that the user has access to',\n responses: {\n 200: {\n description: 'A list of pets.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/pet',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n })\n\n expect(result).toEqual({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n paths: {\n '/pets': {\n get: {\n description: 'Returns all pets from the system that the user has access to',\n responses: {\n 200: {\n description: 'A list of pets.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/pet',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n })\n })\n })\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,2BAA2B;AAEpC,SAAS,kBAAkB,MAAM;AAC/B,WAAS,iBAAiB,MAAM;AAE9B,aAAS,yBAAyB,MAAM;AACtC,SAAG,2GAA2G,MAAM;AAClH,cAAM,SAAS,oBAAoB,MAAM;AAAA,UACvC,SAAS;AAAA,UACT,MAAM;AAAA,YACJ,OAAO;AAAA,YACP,SAAS;AAAA,UACX;AAAA,UACA,SAAS;AAAA,YACP;AAAA,cACE,KAAK;AAAA,cACL,aAAa;AAAA,YACf;AAAA,YACA;AAAA,cACE,KAAK;AAAA,cACL,aAAa;AAAA,YACf;AAAA,YACA;AAAA,cACE,KAAK;AAAA,cACL,aAAa;AAAA,YACf;AAAA,UACF;AAAA,QACF,CAAC;AAED,eAAO,MAAM,EAAE,QAAQ;AAAA,UACrB,SAAS;AAAA,UACT,MAAM;AAAA,YACJ,OAAO;AAAA,YACP,SAAS;AAAA,UACX;AAAA,UACA,SAAS;AAAA,YACP;AAAA,cACE,KAAK;AAAA,cACL,aAAa;AAAA,YACf;AAAA,YACA;AAAA,cACE,KAAK;AAAA,cACL,aAAa;AAAA,YACf;AAAA,YACA;AAAA,cACE,KAAK;AAAA,cACL,aAAa;AAAA,YACf;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAED,OAAG,4EAA4E,MAAM;AACnF,YAAM,SAAS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