@nestjs/swagger#ApiPropertyOptions TypeScript Examples

The following examples show how to use @nestjs/swagger#ApiPropertyOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: api-schemas.ts    From aqualink-app with MIT License 6 votes vote down vote up
PointSchema: SchemaObject & ApiPropertyOptions = {
  type: 'object',
  properties: {
    type: {
      type: 'string',
      // Since type can only be 'Point' for now, we declare it as a enum with a single value
      // This is the only way to declare a constant value on a property
      // Reference: https://swagger.io/docs/specification/describing-parameters/#constant
      enum: ['Point'],
    },
    coordinates: {
      type: 'array',
      description: 'Longitude and latitude',
      items: {
        type: 'number',
      },
      example: [15.24012, -10.05412],
    },
  },
}
Example #2
Source File: api-sensor-data.ts    From aqualink-app with MIT License 6 votes vote down vote up
sensorDataSchema: ApiPropertyOptions = {
  type: 'object',
  properties: {
    [SourceType.SPOTTER]: {
      type: 'object',
      properties: {
        [Metric.BOTTOM_TEMPERATURE]: {
          $ref: getSchemaPath(TimeSeriesPoint),
        },
        [Metric.TOP_TEMPERATURE]: {
          $ref: getSchemaPath(TimeSeriesPoint),
        },
      },
    },
    [SourceType.HOBO]: {
      type: 'object',
      properties: {
        [Metric.BOTTOM_TEMPERATURE]: {
          $ref: getSchemaPath(TimeSeriesPoint),
        },
      },
    },
    [SourceType.NOAA]: {
      type: 'object',
      properties: {
        [Metric.SATELLITE_TEMPERATURE]: {
          $ref: getSchemaPath(TimeSeriesPoint),
        },
      },
    },
  },
}