Skip to content

Commit

Permalink
fix: type
Browse files Browse the repository at this point in the history
  • Loading branch information
Himenon committed Feb 11, 2024
1 parent f8a8036 commit eda9543
Show file tree
Hide file tree
Showing 4 changed files with 380 additions and 1,532 deletions.
4 changes: 2 additions & 2 deletions src/internal/OpenApiTools/Walker/Operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export const create = (rootSchema: OpenApi.Document): State => {
const parameters = [...(pathItem.parameters || []), ...(operation.parameters || [])] as OpenApi.Parameter[];

const requestBody = operation.requestBody as OpenApi.RequestBody | undefined;
const hasRequestBody = requestBody ? Object.values(requestBody.content).filter(Boolean).length > 0 : false;
const hasValidMediaType = Object.values(requestBody?.content || {}).filter(mediaType => Object.values(mediaType).length > 0).length > 0;

state[operation.operationId] = {
httpMethod,
requestUri,
comment: [operation.summary, operation.description].filter(Boolean).join(EOL),
deprecated: !!operation.deprecated,
requestBody: hasRequestBody ? requestBody : undefined,
requestBody: hasValidMediaType ? requestBody : undefined,
parameters: uniqParameters(parameters),
responses: operation.responses as CodeGenerator.OpenApiResponses,
};
Expand Down
Loading

0 comments on commit eda9543

Please sign in to comment.