@kubb/oas 2.15.0 → 2.16.0

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.d.cts CHANGED
@@ -19,24 +19,24 @@ declare module 'openapi-format' {
19
19
  sort?: boolean
20
20
  output?: string
21
21
  sortSet?: {
22
- root?: Array<'openapi', 'info', 'servers', 'paths', 'components', 'tags', 'x-tagGroups', 'externalDocs'>
23
- get?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
24
- post?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
25
- put?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
26
- patch?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
27
- delete?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
28
- parameters?: Array<'name', 'in', 'description', 'required', 'schema'>
29
- requestBody?: Array<'description', 'required', 'content'>
30
- responses?: Array<'description', 'headers', 'content', 'links'>
22
+ root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>
23
+ get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
24
+ post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
25
+ put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
26
+ patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
27
+ delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
28
+ parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>
29
+ requestBody?: Array<'description' | 'required' | 'content'>
30
+ responses?: Array<'description' | 'headers' | 'content' | 'links'>
31
31
  content?: Array<string>
32
- components?: Array<'parameters', 'schemas'>
33
- schema?: Array<'description', 'type', 'items', 'properties', 'format', 'example', 'default'>
34
- schemas?: Array<'description', 'type', 'items', 'properties', 'format', 'example', 'default'>
35
- properties?: Array<'description', 'type', 'items', 'format', 'example', 'default', 'enum'>
32
+ components?: Array<'parameters' | 'schemas'>
33
+ schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
34
+ schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
35
+ properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>
36
36
  }
37
37
  filterSet?: {
38
- methods?: Array<'get', 'post', 'put', 'patch', 'delete'>
39
- inverseMethods?: Array<'get', 'post', 'put', 'patch', 'delete'>
38
+ methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>
39
+ inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>
40
40
  tags?: Array<string>
41
41
  inverseTags?: Array<string>
42
42
  operationIds?: Array<string>
package/dist/index.d.ts CHANGED
@@ -19,24 +19,24 @@ declare module 'openapi-format' {
19
19
  sort?: boolean
20
20
  output?: string
21
21
  sortSet?: {
22
- root?: Array<'openapi', 'info', 'servers', 'paths', 'components', 'tags', 'x-tagGroups', 'externalDocs'>
23
- get?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
24
- post?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
25
- put?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
26
- patch?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
27
- delete?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
28
- parameters?: Array<'name', 'in', 'description', 'required', 'schema'>
29
- requestBody?: Array<'description', 'required', 'content'>
30
- responses?: Array<'description', 'headers', 'content', 'links'>
22
+ root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>
23
+ get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
24
+ post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
25
+ put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
26
+ patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
27
+ delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
28
+ parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>
29
+ requestBody?: Array<'description' | 'required' | 'content'>
30
+ responses?: Array<'description' | 'headers' | 'content' | 'links'>
31
31
  content?: Array<string>
32
- components?: Array<'parameters', 'schemas'>
33
- schema?: Array<'description', 'type', 'items', 'properties', 'format', 'example', 'default'>
34
- schemas?: Array<'description', 'type', 'items', 'properties', 'format', 'example', 'default'>
35
- properties?: Array<'description', 'type', 'items', 'format', 'example', 'default', 'enum'>
32
+ components?: Array<'parameters' | 'schemas'>
33
+ schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
34
+ schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
35
+ properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>
36
36
  }
37
37
  filterSet?: {
38
- methods?: Array<'get', 'post', 'put', 'patch', 'delete'>
39
- inverseMethods?: Array<'get', 'post', 'put', 'patch', 'delete'>
38
+ methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>
39
+ inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>
40
40
  tags?: Array<string>
41
41
  inverseTags?: Array<string>
42
42
  operationIds?: Array<string>
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/parser/index.ts"],"names":["oas"],"mappings":";;;;;;;AAAA,OAAO,kBAAkB;AACzB,OAAO,qBAAqB;AAS5B,eAAsB,MAAM,WAAiC,UAAiC,CAAC,GAAiB;AAC9G,QAAM,eAAe,IAAI,aAAa,WAAW;AAAA,IAC/C,aAAa;AAAA,IACb,gBAAgB;AAAA,EAClB,CAAC;AACD,MAAI;AAEJ,MAAI;AAEF,eAAW,MAAM,aAAa,OAAO;AAAA,EACvC,SAAS,GAAG;AACV,eAAY,MAAM,aAAa,KAAK;AAAA,EACtC;AAEA,MAAI,oBAAoB,QAAQ,GAAG;AACjC,UAAM,EAAE,QAAQ,IAAI,MAAM,gBAAgB,WAAW,UAAU,EAAE,SAAS,KAAK,CAAC;AAEhF,UAAMA,OAAM,MAAM,cAAc,SAAwB,OAAO;AAE/D,WAAO,IAAI,IAAI,EAAE,KAAKA,KAAmB,CAAC;AAAA,EAC5C;AAEA,QAAM,MAAM,MAAM,cAAc,UAAyB,OAAO;AAEhE,SAAO,IAAI,IAAI,EAAE,IAAI,CAAC;AACxB","sourcesContent":["import OASNormalize from 'oas-normalize'\nimport swagger2openapi from 'swagger2openapi'\n\nimport { Oas } from '../Oas.ts'\nimport { filterAndSort, isOpenApiV2Document } from '../utils.ts'\n\nimport type { OASDocument } from 'oas/types'\nimport type openapiFormat from 'openapi-format'\nimport type { OpenAPI } from 'openapi-types'\n\nexport async function parse(pathOrApi: string | OASDocument, options: openapiFormat.Options = {}): Promise<Oas> {\n const oasNormalize = new OASNormalize(pathOrApi, {\n enablePaths: true,\n colorizeErrors: true,\n })\n let document: OpenAPI.Document\n\n try {\n // resolve external refs\n document = await oasNormalize.bundle()\n } catch (e) {\n document = (await oasNormalize.load()) as OpenAPI.Document\n }\n\n if (isOpenApiV2Document(document)) {\n const { openapi } = await swagger2openapi.convertObj(document, { anchors: true })\n\n const oas = await filterAndSort(openapi as OASDocument, options)\n\n return new Oas({ oas: oas as OASDocument })\n }\n\n const oas = await filterAndSort(document as OASDocument, options)\n\n return new Oas({ oas })\n}\n"]}
1
+ {"version":3,"sources":["../src/parser/index.ts"],"names":["oas"],"mappings":";;;;;;;AAAA,OAAO,kBAAkB;AACzB,OAAO,qBAAqB;AAkD5B,eAAsB,MAAM,WAAiC,UAAyB,CAAC,GAAiB;AACtG,QAAM,eAAe,IAAI,aAAa,WAAW;AAAA,IAC/C,aAAa;AAAA,IACb,gBAAgB;AAAA,EAClB,CAAC;AACD,MAAI;AAEJ,MAAI;AAEF,eAAW,MAAM,aAAa,OAAO;AAAA,EACvC,SAAS,GAAG;AACV,eAAY,MAAM,aAAa,KAAK;AAAA,EACtC;AAEA,MAAI,oBAAoB,QAAQ,GAAG;AACjC,UAAM,EAAE,QAAQ,IAAI,MAAM,gBAAgB,WAAW,UAAU,EAAE,SAAS,KAAK,CAAC;AAEhF,UAAMA,OAAM,MAAM,cAAc,SAAwB,OAAO;AAE/D,WAAO,IAAI,IAAI,EAAE,KAAKA,KAAmB,CAAC;AAAA,EAC5C;AAEA,QAAM,MAAM,MAAM,cAAc,UAAyB,OAAO;AAEhE,SAAO,IAAI,IAAI,EAAE,IAAI,CAAC;AACxB","sourcesContent":["import OASNormalize from 'oas-normalize'\nimport swagger2openapi from 'swagger2openapi'\n\nimport { Oas } from '../Oas.ts'\nimport { filterAndSort, isOpenApiV2Document } from '../utils.ts'\n\nimport type { OASDocument } from 'oas/types'\nimport type { OpenAPI } from 'openapi-types'\n\nexport type FormatOptions = {\n verbose?: boolean\n 'no-sort'?: boolean\n sort?: boolean\n output?: string\n sortSet?: {\n root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>\n get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>\n requestBody?: Array<'description' | 'required' | 'content'>\n responses?: Array<'description' | 'headers' | 'content' | 'links'>\n content?: Array<string>\n components?: Array<'parameters' | 'schemas'>\n schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>\n schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>\n properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>\n }\n filterSet?: {\n methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>\n inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>\n tags?: Array<string>\n inverseTags?: Array<string>\n operationIds?: Array<string>\n inverseOperationIds?: Array<string>\n operations?: Array<string>\n flags?: Array<string>\n inverseFlags?: Array<string>\n flagValues?: Array<string>\n inverseFlagValues?: Array<string>\n stripFlags?: Array<string>\n responseContent?: Array<string>\n inverseResponseContent?: Array<string>\n unusedComponents?: Array<'requestBodies' | 'schemas' | 'parameters' | 'responses'>\n }\n sortComponentsSet?: {}\n casingSet?: {}\n}\n\nexport async function parse(pathOrApi: string | OASDocument, options: FormatOptions = {}): Promise<Oas> {\n const oasNormalize = new OASNormalize(pathOrApi, {\n enablePaths: true,\n colorizeErrors: true,\n })\n let document: OpenAPI.Document\n\n try {\n // resolve external refs\n document = await oasNormalize.bundle()\n } catch (e) {\n document = (await oasNormalize.load()) as OpenAPI.Document\n }\n\n if (isOpenApiV2Document(document)) {\n const { openapi } = await swagger2openapi.convertObj(document, { anchors: true })\n\n const oas = await filterAndSort(openapi as OASDocument, options)\n\n return new Oas({ oas: oas as OASDocument })\n }\n\n const oas = await filterAndSort(document as OASDocument, options)\n\n return new Oas({ oas })\n}\n"]}
package/dist/parser.d.cts CHANGED
@@ -1,9 +1,49 @@
1
1
  import { O as Oas } from './Oas-BEe7KZDj.cjs';
2
2
  import { OASDocument } from 'oas/types';
3
- import openapiFormat from 'openapi-format';
4
3
  import 'oas';
5
4
  import 'oas/operation';
6
5
 
7
- declare function parse(pathOrApi: string | OASDocument, options?: openapiFormat.Options): Promise<Oas>;
6
+ type FormatOptions = {
7
+ verbose?: boolean;
8
+ 'no-sort'?: boolean;
9
+ sort?: boolean;
10
+ output?: string;
11
+ sortSet?: {
12
+ root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>;
13
+ get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
14
+ post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
15
+ put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
16
+ patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
17
+ delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
18
+ parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>;
19
+ requestBody?: Array<'description' | 'required' | 'content'>;
20
+ responses?: Array<'description' | 'headers' | 'content' | 'links'>;
21
+ content?: Array<string>;
22
+ components?: Array<'parameters' | 'schemas'>;
23
+ schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>;
24
+ schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>;
25
+ properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>;
26
+ };
27
+ filterSet?: {
28
+ methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>;
29
+ inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>;
30
+ tags?: Array<string>;
31
+ inverseTags?: Array<string>;
32
+ operationIds?: Array<string>;
33
+ inverseOperationIds?: Array<string>;
34
+ operations?: Array<string>;
35
+ flags?: Array<string>;
36
+ inverseFlags?: Array<string>;
37
+ flagValues?: Array<string>;
38
+ inverseFlagValues?: Array<string>;
39
+ stripFlags?: Array<string>;
40
+ responseContent?: Array<string>;
41
+ inverseResponseContent?: Array<string>;
42
+ unusedComponents?: Array<'requestBodies' | 'schemas' | 'parameters' | 'responses'>;
43
+ };
44
+ sortComponentsSet?: {};
45
+ casingSet?: {};
46
+ };
47
+ declare function parse(pathOrApi: string | OASDocument, options?: FormatOptions): Promise<Oas>;
8
48
 
9
- export { parse };
49
+ export { type FormatOptions, parse };
package/dist/parser.d.ts CHANGED
@@ -1,9 +1,49 @@
1
1
  import { O as Oas } from './Oas-BEe7KZDj.js';
2
2
  import { OASDocument } from 'oas/types';
3
- import openapiFormat from 'openapi-format';
4
3
  import 'oas';
5
4
  import 'oas/operation';
6
5
 
7
- declare function parse(pathOrApi: string | OASDocument, options?: openapiFormat.Options): Promise<Oas>;
6
+ type FormatOptions = {
7
+ verbose?: boolean;
8
+ 'no-sort'?: boolean;
9
+ sort?: boolean;
10
+ output?: string;
11
+ sortSet?: {
12
+ root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>;
13
+ get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
14
+ post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
15
+ put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
16
+ patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
17
+ delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>;
18
+ parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>;
19
+ requestBody?: Array<'description' | 'required' | 'content'>;
20
+ responses?: Array<'description' | 'headers' | 'content' | 'links'>;
21
+ content?: Array<string>;
22
+ components?: Array<'parameters' | 'schemas'>;
23
+ schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>;
24
+ schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>;
25
+ properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>;
26
+ };
27
+ filterSet?: {
28
+ methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>;
29
+ inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>;
30
+ tags?: Array<string>;
31
+ inverseTags?: Array<string>;
32
+ operationIds?: Array<string>;
33
+ inverseOperationIds?: Array<string>;
34
+ operations?: Array<string>;
35
+ flags?: Array<string>;
36
+ inverseFlags?: Array<string>;
37
+ flagValues?: Array<string>;
38
+ inverseFlagValues?: Array<string>;
39
+ stripFlags?: Array<string>;
40
+ responseContent?: Array<string>;
41
+ inverseResponseContent?: Array<string>;
42
+ unusedComponents?: Array<'requestBodies' | 'schemas' | 'parameters' | 'responses'>;
43
+ };
44
+ sortComponentsSet?: {};
45
+ casingSet?: {};
46
+ };
47
+ declare function parse(pathOrApi: string | OASDocument, options?: FormatOptions): Promise<Oas>;
8
48
 
9
- export { parse };
49
+ export { type FormatOptions, parse };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/parser/index.ts"],"sourcesContent":["import OASNormalize from 'oas-normalize'\nimport swagger2openapi from 'swagger2openapi'\n\nimport { Oas } from '../Oas.ts'\nimport { filterAndSort, isOpenApiV2Document } from '../utils.ts'\n\nimport type { OASDocument } from 'oas/types'\nimport type openapiFormat from 'openapi-format'\nimport type { OpenAPI } from 'openapi-types'\n\nexport async function parse(pathOrApi: string | OASDocument, options: openapiFormat.Options = {}): Promise<Oas> {\n const oasNormalize = new OASNormalize(pathOrApi, {\n enablePaths: true,\n colorizeErrors: true,\n })\n let document: OpenAPI.Document\n\n try {\n // resolve external refs\n document = await oasNormalize.bundle()\n } catch (e) {\n document = (await oasNormalize.load()) as OpenAPI.Document\n }\n\n if (isOpenApiV2Document(document)) {\n const { openapi } = await swagger2openapi.convertObj(document, { anchors: true })\n\n const oas = await filterAndSort(openapi as OASDocument, options)\n\n return new Oas({ oas: oas as OASDocument })\n }\n\n const oas = await filterAndSort(document as OASDocument, options)\n\n return new Oas({ oas })\n}\n"],"mappings":";;;;;;;AAAA,OAAO,kBAAkB;AACzB,OAAO,qBAAqB;AAS5B,eAAsB,MAAM,WAAiC,UAAiC,CAAC,GAAiB;AAC9G,QAAM,eAAe,IAAI,aAAa,WAAW;AAAA,IAC/C,aAAa;AAAA,IACb,gBAAgB;AAAA,EAClB,CAAC;AACD,MAAI;AAEJ,MAAI;AAEF,eAAW,MAAM,aAAa,OAAO;AAAA,EACvC,SAAS,GAAG;AACV,eAAY,MAAM,aAAa,KAAK;AAAA,EACtC;AAEA,MAAI,oBAAoB,QAAQ,GAAG;AACjC,UAAM,EAAE,QAAQ,IAAI,MAAM,gBAAgB,WAAW,UAAU,EAAE,SAAS,KAAK,CAAC;AAEhF,UAAMA,OAAM,MAAM,cAAc,SAAwB,OAAO;AAE/D,WAAO,IAAI,IAAI,EAAE,KAAKA,KAAmB,CAAC;AAAA,EAC5C;AAEA,QAAM,MAAM,MAAM,cAAc,UAAyB,OAAO;AAEhE,SAAO,IAAI,IAAI,EAAE,IAAI,CAAC;AACxB;","names":["oas"]}
1
+ {"version":3,"sources":["../src/parser/index.ts"],"sourcesContent":["import OASNormalize from 'oas-normalize'\nimport swagger2openapi from 'swagger2openapi'\n\nimport { Oas } from '../Oas.ts'\nimport { filterAndSort, isOpenApiV2Document } from '../utils.ts'\n\nimport type { OASDocument } from 'oas/types'\nimport type { OpenAPI } from 'openapi-types'\n\nexport type FormatOptions = {\n verbose?: boolean\n 'no-sort'?: boolean\n sort?: boolean\n output?: string\n sortSet?: {\n root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>\n get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>\n parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>\n requestBody?: Array<'description' | 'required' | 'content'>\n responses?: Array<'description' | 'headers' | 'content' | 'links'>\n content?: Array<string>\n components?: Array<'parameters' | 'schemas'>\n schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>\n schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>\n properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>\n }\n filterSet?: {\n methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>\n inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>\n tags?: Array<string>\n inverseTags?: Array<string>\n operationIds?: Array<string>\n inverseOperationIds?: Array<string>\n operations?: Array<string>\n flags?: Array<string>\n inverseFlags?: Array<string>\n flagValues?: Array<string>\n inverseFlagValues?: Array<string>\n stripFlags?: Array<string>\n responseContent?: Array<string>\n inverseResponseContent?: Array<string>\n unusedComponents?: Array<'requestBodies' | 'schemas' | 'parameters' | 'responses'>\n }\n sortComponentsSet?: {}\n casingSet?: {}\n}\n\nexport async function parse(pathOrApi: string | OASDocument, options: FormatOptions = {}): Promise<Oas> {\n const oasNormalize = new OASNormalize(pathOrApi, {\n enablePaths: true,\n colorizeErrors: true,\n })\n let document: OpenAPI.Document\n\n try {\n // resolve external refs\n document = await oasNormalize.bundle()\n } catch (e) {\n document = (await oasNormalize.load()) as OpenAPI.Document\n }\n\n if (isOpenApiV2Document(document)) {\n const { openapi } = await swagger2openapi.convertObj(document, { anchors: true })\n\n const oas = await filterAndSort(openapi as OASDocument, options)\n\n return new Oas({ oas: oas as OASDocument })\n }\n\n const oas = await filterAndSort(document as OASDocument, options)\n\n return new Oas({ oas })\n}\n"],"mappings":";;;;;;;AAAA,OAAO,kBAAkB;AACzB,OAAO,qBAAqB;AAkD5B,eAAsB,MAAM,WAAiC,UAAyB,CAAC,GAAiB;AACtG,QAAM,eAAe,IAAI,aAAa,WAAW;AAAA,IAC/C,aAAa;AAAA,IACb,gBAAgB;AAAA,EAClB,CAAC;AACD,MAAI;AAEJ,MAAI;AAEF,eAAW,MAAM,aAAa,OAAO;AAAA,EACvC,SAAS,GAAG;AACV,eAAY,MAAM,aAAa,KAAK;AAAA,EACtC;AAEA,MAAI,oBAAoB,QAAQ,GAAG;AACjC,UAAM,EAAE,QAAQ,IAAI,MAAM,gBAAgB,WAAW,UAAU,EAAE,SAAS,KAAK,CAAC;AAEhF,UAAMA,OAAM,MAAM,cAAc,SAAwB,OAAO;AAE/D,WAAO,IAAI,IAAI,EAAE,KAAKA,KAAmB,CAAC;AAAA,EAC5C;AAEA,QAAM,MAAM,MAAM,cAAc,UAAyB,OAAO;AAEhE,SAAO,IAAI,IAAI,EAAE,IAAI,CAAC;AACxB;","names":["oas"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/oas",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "Oas helpers",
5
5
  "keywords": [
6
6
  "typescript",
@@ -5,10 +5,51 @@ import { Oas } from '../Oas.ts'
5
5
  import { filterAndSort, isOpenApiV2Document } from '../utils.ts'
6
6
 
7
7
  import type { OASDocument } from 'oas/types'
8
- import type openapiFormat from 'openapi-format'
9
8
  import type { OpenAPI } from 'openapi-types'
10
9
 
11
- export async function parse(pathOrApi: string | OASDocument, options: openapiFormat.Options = {}): Promise<Oas> {
10
+ export type FormatOptions = {
11
+ verbose?: boolean
12
+ 'no-sort'?: boolean
13
+ sort?: boolean
14
+ output?: string
15
+ sortSet?: {
16
+ root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>
17
+ get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
18
+ post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
19
+ put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
20
+ patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
21
+ delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
22
+ parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>
23
+ requestBody?: Array<'description' | 'required' | 'content'>
24
+ responses?: Array<'description' | 'headers' | 'content' | 'links'>
25
+ content?: Array<string>
26
+ components?: Array<'parameters' | 'schemas'>
27
+ schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
28
+ schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
29
+ properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>
30
+ }
31
+ filterSet?: {
32
+ methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>
33
+ inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>
34
+ tags?: Array<string>
35
+ inverseTags?: Array<string>
36
+ operationIds?: Array<string>
37
+ inverseOperationIds?: Array<string>
38
+ operations?: Array<string>
39
+ flags?: Array<string>
40
+ inverseFlags?: Array<string>
41
+ flagValues?: Array<string>
42
+ inverseFlagValues?: Array<string>
43
+ stripFlags?: Array<string>
44
+ responseContent?: Array<string>
45
+ inverseResponseContent?: Array<string>
46
+ unusedComponents?: Array<'requestBodies' | 'schemas' | 'parameters' | 'responses'>
47
+ }
48
+ sortComponentsSet?: {}
49
+ casingSet?: {}
50
+ }
51
+
52
+ export async function parse(pathOrApi: string | OASDocument, options: FormatOptions = {}): Promise<Oas> {
12
53
  const oasNormalize = new OASNormalize(pathOrApi, {
13
54
  enablePaths: true,
14
55
  colorizeErrors: true,
package/src/typings.d.ts CHANGED
@@ -5,24 +5,24 @@ declare module 'openapi-format' {
5
5
  sort?: boolean
6
6
  output?: string
7
7
  sortSet?: {
8
- root?: Array<'openapi', 'info', 'servers', 'paths', 'components', 'tags', 'x-tagGroups', 'externalDocs'>
9
- get?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
10
- post?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
11
- put?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
12
- patch?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
13
- delete?: Array<'operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'>
14
- parameters?: Array<'name', 'in', 'description', 'required', 'schema'>
15
- requestBody?: Array<'description', 'required', 'content'>
16
- responses?: Array<'description', 'headers', 'content', 'links'>
8
+ root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>
9
+ get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
10
+ post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
11
+ put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
12
+ patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
13
+ delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
14
+ parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>
15
+ requestBody?: Array<'description' | 'required' | 'content'>
16
+ responses?: Array<'description' | 'headers' | 'content' | 'links'>
17
17
  content?: Array<string>
18
- components?: Array<'parameters', 'schemas'>
19
- schema?: Array<'description', 'type', 'items', 'properties', 'format', 'example', 'default'>
20
- schemas?: Array<'description', 'type', 'items', 'properties', 'format', 'example', 'default'>
21
- properties?: Array<'description', 'type', 'items', 'format', 'example', 'default', 'enum'>
18
+ components?: Array<'parameters' | 'schemas'>
19
+ schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
20
+ schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
21
+ properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>
22
22
  }
23
23
  filterSet?: {
24
- methods?: Array<'get', 'post', 'put', 'patch', 'delete'>
25
- inverseMethods?: Array<'get', 'post', 'put', 'patch', 'delete'>
24
+ methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>
25
+ inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete'>
26
26
  tags?: Array<string>
27
27
  inverseTags?: Array<string>
28
28
  operationIds?: Array<string>