Skip to content

Commit

Permalink
fix: 解析schema问题
Browse files Browse the repository at this point in the history
  • Loading branch information
huajiayi committed Oct 6, 2021
1 parent 577fd5b commit 37de829
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/main.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const getApis = (data, definitions, types, version) => {
if (api?.requestBody) {
const content = api.requestBody.content;
const firstProp = Object.keys(content)[0];
const schema = content[firstProp];
const schema = content[firstProp].schema;
const originalRef = getOriginalRef(schema.$ref);
const properties = definitions[originalRef]?.properties;
if (!properties) {
Expand Down
2 changes: 1 addition & 1 deletion dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const getApis = (data, definitions, types, version) => {
if (api?.requestBody) {
const content = api.requestBody.content;
const firstProp = Object.keys(content)[0];
const schema = content[firstProp];
const schema = content[firstProp].schema;
const originalRef = getOriginalRef(schema.$ref);
const properties = definitions[originalRef]?.properties;
if (!properties) {
Expand Down
2 changes: 1 addition & 1 deletion example/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { resolve } = require('path');

// const url = 'http://192.168.11.40:7300/mock/6093b81a9055d00017a6a31b/swagger';
// const url = 'http://localhost:8080/api/v3/api-docs';
const url = 'https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json';
const url = 'http://localhost:8081/v3/api-docs';
const outputDir = resolve(__dirname, 'service');

const openApiTool = new OpenApiTool({url});
Expand Down
2 changes: 1 addition & 1 deletion src/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const getApis = (
if (api?.requestBody) {
const content = (api.requestBody as any).content;
const firstProp = Object.keys(content)[0];
const schema = content[firstProp];
const schema = content[firstProp].schema;
const originalRef = getOriginalRef(schema.$ref);
const properties = definitions[originalRef]?.properties;
if (!properties) {
Expand Down

0 comments on commit 37de829

Please sign in to comment.