Skip to content

Commit

Permalink
updated annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolb committed Aug 30, 2023
1 parent d24d535 commit 045c4b5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Revalidate: This script is a combination of the generate and lint steps. Useful
npm run revalidate
```

generatePostman: creates the postman collection from the OpenAPI Document
generatePostman: creates the postman collection from the OpenAPI Document

```bash
npm run generatePostman
Expand Down
16 changes: 13 additions & 3 deletions spec/petStore.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"openapi": "3.0.0",
"info": {
"title": "",
"title": "PetStore",
"version": "1.0.0-rev1",
"description": "This is the API for the Pet Store.",
"license": {
Expand Down Expand Up @@ -540,10 +540,12 @@
},
"delete": {
"operationId": "DeletePet",
"description": "Remove a pet when its adopted",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id of the pet to update",
"required": true,
"schema": {
"type": "number",
Expand All @@ -552,8 +554,16 @@
}
],
"responses": {
"200": {
"description": "Ok",
"204": {

Check warning on line 557 in spec/petStore.json

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

tracking-id-header-requirement

All responses must include a 'TrackingID' header.
"description": "No Content",
"headers": {

Check notice on line 559 in spec/petStore.json

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-etag-cache-control-header-required

Where caching is not appropriate, operations must include a Cache-Control header (e.g. max-age=0, no-cache, no-store, must-revalidate) and must not include an ETag header.; "headers.Cache-Control" property must be truthy
"CommonResponseHeader": {
"schema": {
"$ref": "#/components/schemas/CommonResponseHeader"
},
"description": "Common Headers Returned"
}
},
"content": {
"application/json": {
"schema": {
Expand Down
5 changes: 5 additions & 0 deletions src/controllers/PetController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ export class PetController extends Controller {
return updatedPet;
}

/**
* Remove a pet when its adopted
* @param id id of the pet to update
*/
@Delete('{id}')
@SuccessResponse<CommonResponseHeader>('204', 'No Content')
public async deletePet(@Path() id: number): Promise<Pet | null> {
const deletedPet = deletePetById(id);
if (deletedPet === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export function RegisterRoutes(app: Router) {
const controller = new PetController();

const promise = controller.deletePet.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, undefined, next);
promiseHandler(controller, promise, response, 204, next);
} catch (err) {
return next(err);
}
Expand Down

0 comments on commit 045c4b5

Please sign in to comment.