@api-ts/openapi-generator
Advanced tools
Comparing version
@@ -147,15 +147,20 @@ "use strict"; | ||
if (headerSchema.schemas.length > 0) { | ||
const firstHeaderSchema = schema.schemas.find((s) => { var _a; return s.type === 'object' && ((_a = s.properties['headers']) === null || _a === void 0 ? void 0 : _a.type) === 'object'; }); | ||
if ((firstHeaderSchema === null || firstHeaderSchema === void 0 ? void 0 : firstHeaderSchema.type) === 'object' && | ||
((_a = firstHeaderSchema.properties['headers']) === null || _a === void 0 ? void 0 : _a.type) === 'object') { | ||
const headers = firstHeaderSchema.properties['headers']; | ||
for (const [name, prop] of Object.entries(headers.properties)) { | ||
parameters.push({ | ||
type: 'header', | ||
name, | ||
schema: prop, | ||
required: headers.required.includes(name), | ||
}); | ||
const headerParams = new Map(); | ||
for (const subSchema of schema.schemas) { | ||
if (subSchema.type === 'object' && | ||
((_a = subSchema.properties['headers']) === null || _a === void 0 ? void 0 : _a.type) === 'object') { | ||
const headers = subSchema.properties['headers']; | ||
for (const [name, prop] of Object.entries(headers.properties)) { | ||
if (!headerParams.has(name)) { | ||
headerParams.set(name, { | ||
type: 'header', | ||
name, | ||
schema: prop, | ||
required: headers.required.includes(name), | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
parameters.push(...headerParams.values()); | ||
} | ||
@@ -162,0 +167,0 @@ const firstSubSchema = schema.schemas[0]; |
{ | ||
"name": "@api-ts/openapi-generator", | ||
"version": "5.5.1", | ||
"version": "5.5.2", | ||
"description": "Generate an OpenAPI specification from an io-ts-http contract", | ||
@@ -5,0 +5,0 @@ "author": "Patrick McLaughlin <patrickmclaughlin@bitgo.com>", |
@@ -59,5 +59,5 @@ # @api-ts/openapi-generator | ||
directory, then add `src/` to the files array in the `package.json` of your project. | ||
2. After Step 1, change the `types` field in the `package.json` to be the entry point of | ||
the types in the source code. For example, if the entrypoint is `src/index.ts`, then | ||
set `"types": "src/index.ts"` in the `package.json` | ||
2. After Step 1, change the `source` field in the `package.json` to be the entry point | ||
of the types in the source code. For example, if the entrypoint is `src/index.ts`, | ||
then set `"source": "src/index.ts"` in the `package.json` | ||
@@ -64,0 +64,0 @@ ## 4. Defining Custom Codecs |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
262921
03271
0.15%