Function createSwaggerSchemaForApiListResponse

  • Creates a Swagger schema, which describes a standard API response for a list with custom data schema for its items.

    Parameters

    Returns OpenAPIV3.SchemaObject

    The new schema.

    Example

    import { Controller, ControllerBase, GET, IHttpRequest, IHttpResponse } from '@egomobile/http-server'
    import { createSwaggerSchemaForApiListResponse } from '@egomobile/api-utils'

    @Controller()
    export default class IndexController extends ControllerBase {
    @GET({
    path: '/',
    documentation: {
    summary: 'This is a description of that endpoint',
    responses: {
    '200': {
    description: 'Operation was successful.',
    content: {
    'application/json': {
    schema: createSwaggerSchemaForApiListResponse({
    itemsSchema: {
    type: 'object',
    properties: {
    // ...
    }
    }
    })
    }
    }
    }
    }
    }
    })
    async index(request: IHttpRequest, response: IHttpResponse) {
    // ...
    }
    }

Generated using TypeDoc