Skip to content

Commit

Permalink
fix(api-extension): Add test case for array in e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
jiqiang90 committed Feb 5, 2021
1 parent 016dadc commit eb4916a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions e2e/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@
},
"get": {
"operationId": "CatsController_findAll",
"x-codeSamples": [
{
"lang": "JavaScript",
"source": "console.log('Hello World');"
}
],
"parameters": [
{
"name": "header",
Expand Down
3 changes: 3 additions & 0 deletions e2e/src/cats/cats.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export class CatsController {
}

@Get()
@ApiExtension('x-codeSamples', [
{ lang: 'JavaScript', source: "console.log('Hello World');" }
])
findAll(@Query() paginationQuery: PaginationQuery) {}

@ApiQuery({ type: PaginationQuery })
Expand Down
3 changes: 3 additions & 0 deletions e2e/validate-schema.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ describe('Validate OpenAPI schema', () => {
api.info.version
);
expect(api.info.title).toEqual('Cats example');
expect(api.paths['/api/cats']['get']['x-codeSamples'][0]['lang']).toEqual(
'JavaScript'
);
} catch (err) {
console.log(doc);
expect(err).toBeUndefined();
Expand Down

0 comments on commit eb4916a

Please sign in to comment.