Skip to content

Commit

Permalink
no annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Tolbert committed Sep 8, 2023
1 parent b32dabe commit fc25083
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 116 deletions.
176 changes: 88 additions & 88 deletions kong/petKong.yaml
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
_format_version: "3.0"
_format_version: '3.0'
services:
- host: pet-store-kong-3abae03b4c44.herokuapp.com
id: 6ce82fd3-ffaa-564d-a98e-7b6cf11d7b5a
name: petstore
path: /v1
plugins: []
port: 80
protocol: http
routes:
- id: 9e26c451-2d9f-5150-88b5-2f54569f11e2
methods:
- GET
name: petstore_listhumans
paths:
- ~/humans$
- host: pet-store-kong-3abae03b4c44.herokuapp.com
id: 6ce82fd3-ffaa-564d-a98e-7b6cf11d7b5a
name: petstore
path: /v1
plugins: []
regex_priority: 200
strip_path: false
port: 80
protocol: http
routes:
- id: 9e26c451-2d9f-5150-88b5-2f54569f11e2
methods:
- GET
name: petstore_listhumans
paths:
- ~/humans$
plugins: []
regex_priority: 200
strip_path: false
tags: []
- id: 1e5e50c3-df1a-5ef5-8504-125fe42f3a78
methods:
- POST
name: petstore_createhuman
paths:
- ~/humans$
plugins: []
regex_priority: 200
strip_path: false
tags: []
- id: 8e00b833-e7e9-5be2-8f97-9f205cac53e7
methods:
- GET
name: petstore_gethuman
paths:
- ~/humans/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
- id: fcabe360-daec-5fbf-a2be-50f393c23e38
methods:
- GET
name: petstore_listpets
paths:
- ~/pets$
plugins: []
regex_priority: 200
strip_path: false
tags: []
- id: b3862911-a318-51f8-99e7-5f6f3685c61f
methods:
- POST
name: petstore_createpet
paths:
- ~/pets$
plugins: []
regex_priority: 200
strip_path: false
tags: []
- id: fe28075b-dc30-5646-869e-567b749aa8e9
methods:
- DELETE
name: petstore_deletepet
paths:
- ~/pets/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
- id: 0ef5ebf6-6973-5d23-a051-ab9367803be3
methods:
- GET
name: petstore_getpet
paths:
- ~/pets/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
- id: 7f1a9c95-7df0-5a54-8619-a59ace7f5604
methods:
- PUT
name: petstore_updatepet
paths:
- ~/pets/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
tags: []
- id: 1e5e50c3-df1a-5ef5-8504-125fe42f3a78
methods:
- POST
name: petstore_createhuman
paths:
- ~/humans$
plugins: []
regex_priority: 200
strip_path: false
tags: []
- id: 8e00b833-e7e9-5be2-8f97-9f205cac53e7
methods:
- GET
name: petstore_gethuman
paths:
- ~/humans/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
- id: fcabe360-daec-5fbf-a2be-50f393c23e38
methods:
- GET
name: petstore_listpets
paths:
- ~/pets$
plugins: []
regex_priority: 200
strip_path: false
tags: []
- id: b3862911-a318-51f8-99e7-5f6f3685c61f
methods:
- POST
name: petstore_createpet
paths:
- ~/pets$
plugins: []
regex_priority: 200
strip_path: false
tags: []
- id: fe28075b-dc30-5646-869e-567b749aa8e9
methods:
- DELETE
name: petstore_deletepet
paths:
- ~/pets/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
- id: 0ef5ebf6-6973-5d23-a051-ab9367803be3
methods:
- GET
name: petstore_getpet
paths:
- ~/pets/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
- id: 7f1a9c95-7df0-5a54-8619-a59ace7f5604
methods:
- PUT
name: petstore_updatepet
paths:
- ~/pets/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
tags: []
upstreams: []
3 changes: 1 addition & 2 deletions spec/petStore.json
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@
"type": "object",
"properties": {
"items": {
"description": "The list of pets",
"description": "The list of humans",
"type": "array",
"items": {
"$ref": "#/components/schemas/Human"
Expand All @@ -1030,7 +1030,6 @@
"type": "object",
"properties": {
"location": {
"description": "The URI of the Human",
"type": "string"
}
},
Expand Down
32 changes: 7 additions & 25 deletions src/controllers/HumanController.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
import { Route, Get, Post, Path, Body, OperationId, Tags, SuccessResponse, Response, Security } from 'tsoa';
import { Route, Get, Post, Path, Body, OperationId, Tags, SuccessResponse, Security } from 'tsoa';

import { Controller } from '@tsoa/runtime';
import { HumansList, getHumans, getHumanById, Human, ErrorBody, CreateHumanRequest, createHuman } from '../models/Human';
import { HumansList, getHumans, getHumanById, Human, CreateHumanRequest, createHuman } from '../models/Human';


/**
* @tsoaModel
* @example
* {
* "location": "https://petstore.com/v1/humans/1"
* }
*/
interface LocationHeader {
/**
* The URI of the Human
*/
location: string;
}

@Route('humans')
@Response<ErrorBody & { message: 'User is not authorized' }>(401, 'Unauthorized')
@Response<ErrorBody & { message: 'User is forbidden to access the resource' }>(403, 'Forbidden')
// @Response<ErrorBody & { message: 'User is not authorized' }>(401, 'Unauthorized')
// @Response<ErrorBody & { message: 'User is forbidden to access the resource' }>(403, 'Forbidden')
@Security('api_key')
export class HumanController extends Controller {
/**
* Lists all humans in the PetStore
*/

@Get()
@OperationId('listHumans')
@Tags('Read')
Expand All @@ -33,10 +22,6 @@ export class HumanController extends Controller {
return getHumans();
}

/**
* Get a human by its id
* @param id id of the human to fetch
*/
@Get('{id}')
@Tags('Read')
@OperationId('getHuman')
Expand All @@ -50,10 +35,7 @@ export class HumanController extends Controller {
return human;
}

/**
* Create a new pet with its adorable name
* @param createHumanRequest the information to create the pet
*/

@Post()
@Tags('Write')
@SuccessResponse<LocationHeader>('201', 'Created')
Expand Down
2 changes: 1 addition & 1 deletion src/models/Human.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
export interface HumansList {
/**
* The list of pets
* The list of humans
*/
items: Human[];
}
Expand Down

0 comments on commit fc25083

Please sign in to comment.