How to use the @foal/core.ApiOperation function in @foal/core

To help you get started, we’ve selected a few @foal/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
})
    @ApiRequestBody({
      content: {
        '*/*': {
          schema: { $ref: '#/components/schemas/User' }
        }
      },
      description: 'Updated user object',
      required: true
    })
    @ApiResponse(400, { description: 'Invalid user supplied', content: {} })
    @ApiResponse(404, { description: 'User not found', content: {} })
    updateUser() {}

    @Delete('/:username')
    @ApiOperation({
      description: 'This can only be done by the logged in user.',
      operationId: 'deleteUser',
      responses: {},
      summary: 'Delete user'
    })
    @ApiParameter({
      description: 'The name that needs to be deleted',
      in: 'path',
      name: 'username',
      required: true,
      schema: { type: 'string' }
    })
    @ApiResponse(400, { description: 'Invalid username supplied', content: {} })
    @ApiResponse(404, { description: 'User not found', content: {} })
    deleteUser() {}
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
@ApiResponse(200, {
      content: {
        'application/json': {
          schema: { $ref: '#/components/schemas/Order' }
        },
        'application/xml': {
          schema: { $ref: '#/components/schemas/Order' }
        },
      },
      description: 'successful operation'
    })
    @ApiResponse(400, { description: 'Invalid Order', content: {} })
    placeOrder() { }

    @Get('/order/:orderId')
    @ApiOperation({
      description: 'For valid response try integer IDs with value >= 1 and <= 10.         Other'
        + '\nvalues will generated exceptions',
      operationId: 'getOrderById',
      responses: {},
      summary: 'Find purchase order by ID'
    })
    @ApiParameter({
      description: 'ID of pet that needs to be fetched',
      in: 'path',
      name: 'orderId',
      required: true,
      schema: {
        format: 'int64',
        maximum: 10.0,
        minimum: 1.0,
        type: 'integer',
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
shipDate: {
        format: 'date-time',
        type: 'string',
      },
      status: {
        description: 'Order Status',
        enum: [ 'placed', 'approved', 'delivered' ],
        type: 'string',
      }
    },
    type: 'object',
    xml: { name: 'Order' }
  })
  class StoreController {
    @Get('/inventory')
    @ApiOperation({
      description: 'Returns a map of status codes to quantities',
      operationId: 'getInventory',
      responses: {},
      summary: 'Returns pet inventories by status'
    })
    @ApiResponse(200, {
      content: {
        'application/json': {
          schema: {
            additionalProperties: {
              format: 'int32',
              type: 'integer',
            },
            type: 'object',
          }
        }
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
content: {
        '*/*': {
          schema: {
            items: { $ref: '#/components/schemas/User' },
            type: 'array',
          }
        }
      },
      description: 'List of user object',
      required: true
    })
    @ApiResponse('default', { description: 'successful operation', content: {} })
    createUsersWithArrayInput() {}

    @Post('/createWithList')
    @ApiOperation({
      operationId: 'createUsersWithListInput',
      responses: {},
      summary: 'Creates list of users with given input array'
    })
    @ApiRequestBody({
      content: {
        '*/*': {
          schema: {
            items: { $ref: '#/components/schemas/User' },
            type: 'array'
          }
        }
      },
      description: 'List of user object',
      required: true
    })
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
tags: {
        items: { $ref: '#/components/schemas/Tag' },
        type: 'array',
        xml: {
          name: 'tag',
          wrapped: true
        }
      }
    },
    required: [ 'name', 'photoUrls' ],
    type: 'object',
    xml: { name: 'Pet' }
  })
  class PetController {
    @Put()
    @ApiOperation({
      operationId: 'updatePet',
      responses: {},
      summary: 'Update an existing pet',
    })
    @ApiRequestBody({
      content: {
        'application/json': {
          schema: { $ref: '#/components/schemas/Pet' }
        },
        'application/xml': {
          schema: { $ref: '#/components/schemas/Pet' }
        },
      },
      description: 'Pet object that needs to be added to the store',
      required: true
    })
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
properties: {
              name: { type: 'string', description: 'Updated name of the pet' },
              status: { type: 'string', description: 'Updated status of the pet' },
            }
          }
        }
      }
    })
    @ApiResponse(405, { description: 'Invalid input', content: {} })
    @ApiSecurityRequirement({
      petstore_auth: ['write:pets', 'read:pets']
    })
    updatePetWithForm() { }

    @Delete('/:petId')
    @ApiOperation({
      operationId: 'deletePet',
      responses: {},
      summary: 'Deletes a pet'
    })
    @ApiParameter({
      in: 'header',
      name: 'api_key',
      schema: { type: 'string' }
    })
    @ApiParameter({
      description: 'Pet id to delete',
      in: 'path',
      name: 'petId',
      required: true,
      schema: {
        format: 'int64',
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
'application/json': {
          schema: { $ref: '#/components/schemas/Pet' }
        },
        'application/xml': {
          schema: { $ref: '#/components/schemas/Pet' }
        },
      },
      description: 'successful operation'
    })
    @ApiResponse(400, { description: 'Invalid ID supplied', content: {} })
    @ApiResponse(404, { description: 'Pet not found', content: {} })
    @ApiSecurityRequirement({ api_key: [] })
    getPetById() { }

    @Post('/:petId')
    @ApiOperation({
      operationId: 'updatePetWithForm',
      responses: {},
      summary: 'Updates a pet in the store with form data'
    })
    @ApiParameter({
      description: 'ID of pet that needs to be updated',
      in: 'path',
      name: 'petId',
      required: true,
      schema: {
        format: 'int64',
        type: 'integer',
      }
    })
    @ApiRequestBody({
      content: {
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
summary: 'Create user'
    })
    @ApiRequestBody({
      content: {
        '*/*': {
          schema: { $ref: '#/components/schemas/User' }
        }
      },
      description: 'Created user object',
      required: true
    })
    @ApiResponse('default', { description: 'successful operation', content: {} })
    createUser() {}

    @Post('/createWithArray')
    @ApiOperation({
      operationId: 'createUsersWithArrayInput',
      responses: {},
      summary: 'Creates list of users with given input array'
    })
    @ApiRequestBody({
      content: {
        '*/*': {
          schema: {
            items: { $ref: '#/components/schemas/User' },
            type: 'array',
          }
        }
      },
      description: 'List of user object',
      required: true
    })
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
name: 'petId',
      required: true,
      schema: {
        format: 'int64',
        type: 'integer',
      }
    })
    @ApiResponse(400, { description: 'Invalid ID supplied', content: {} })
    @ApiResponse(404, { description: 'Pet not found', content: {} })
    @ApiSecurityRequirement({
      petstore_auth: ['write:pets', 'read:pets']
    })
    deletePet() { }

    @Post('/:petId/uploadImage')
    @ApiOperation({
      operationId: 'uploadFile',
      responses: {},
      summary: 'uploads an image'
    })
    @ApiParameter({
      description: 'ID of pet to update',
      in: 'path',
      name: 'petId',
      required: true,
      schema: {
        format: 'int64',
        type: 'integer',
      }
    })
    @ApiRequestBody({
      content: {
github FoalTS / foal / packages / acceptance-tests / src / openapi.spec.ts View on Github external
}
        },
        'X-Rate-Limit': {
          description: 'calls per hour allowed by the user',
          schema: {
            format: 'int32',
            type: 'integer',
          }
        },
      }
    })
    @ApiResponse(400, { description: 'Invalid username/password supplied', content: {} })
    loginUser() {}

    @Get('/logout')
    @ApiOperation({
      operationId: 'logoutUser',
      responses: {},
      summary: 'Logs out current logged in user session',
    })
    @ApiResponse('default', { description: 'successful operation', content: {} })
    logoutUser() {}

    @Get('/:username')
    @ApiUseTag('store')
    @ApiOperation({
      operationId: 'getUserByName',
      responses: {},
      summary: 'Get user by user name'
    })
    @ApiParameter({
      description: 'The name that needs to be fetched. Use user1 for testing. ',