-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db0ecff
commit b172937
Showing
22 changed files
with
129,649 additions
and
2,711 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
1,129 changes: 1,129 additions & 0 deletions
1,129
__fixtures__/output/swagger.overrides.ts → __fixtures__/output/swagger.overrides.all.ts
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
21,156 changes: 21,155 additions & 1 deletion
21,156
__tests__/__snapshots__/openapi.generate.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
5,550 changes: 5,548 additions & 2 deletions
5,550
__tests__/__snapshots__/openapi.overrides.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,48 @@ | ||
import { writeFileSync } from 'fs'; | ||
|
||
import schema from '../__fixtures__/openapi/swagger.json'; | ||
import { getDefaultSchemaTSOptions } from '../src'; | ||
import { generateOpenApiClient } from '../src/openapi'; | ||
|
||
it('swagger', () => { | ||
const code = generateOpenApiClient(schema as any); | ||
const options = getDefaultSchemaTSOptions({ | ||
// include: [ | ||
// '*.v1.*' | ||
// ], | ||
includeMethodComments: true, | ||
namingStrategy: { | ||
useLastSegment: true | ||
} | ||
}) | ||
const code = generateOpenApiClient({ | ||
...options, | ||
version: 'v1', | ||
mergedParams: false | ||
}, schema as any); | ||
expect(code).toMatchSnapshot(); | ||
writeFileSync(__dirname + '/../__fixtures__/output/swagger-client.ts', code); | ||
}); | ||
|
||
it('merged', () => { | ||
const options = getDefaultSchemaTSOptions({ | ||
// include: [ | ||
// '*.v1.*' | ||
// ], | ||
includeMethodComments: true, | ||
namingStrategy: { | ||
useLastSegment: true | ||
} | ||
}) | ||
const code = generateOpenApiClient({ | ||
...options, | ||
version: 'v1', | ||
mergedParams: true | ||
}, schema as any); | ||
expect(code).toMatchSnapshot(); | ||
writeFileSync(__dirname + '/../__fixtures__/output/swagger-client.merged.ts', code); | ||
}); | ||
|
||
it('openapi', () => { | ||
const data = Object.keys(schema.definitions) | ||
writeFileSync(__dirname + '/../__fixtures__/output/swagger-definitions.json', JSON.stringify(data, null, 2)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.