0

I have an response schema that contains java URI, Set and Map. I can't find any example how to code this yaml part for swagger.
How to write the URI, Set and Map part in yaml components: schemas: see below.

My response java code looks like below.

public class ShowStaticInfo {

    private String Id;
    private long time;
    private URI poster;
    private Set<Tag> tags;
    private HashMap<String,Tag> objectCreated;

And the written yaml code like this. As stated above this yaml needs to be changed.

openapi: "3.0.1"
info:
  title: Mobile backend
  version: 1.0.0
  license:
    name: Apache 2.0
servers:
  - url: https://development.cybercom.com/services/6
    description: Development server
  - url: https://staging.cybercom.com/services
    description: Staging server
  - url: https://production.cybercom.com/services
    description: Production server
paths:
  /buildinfo:
    get:
      description: Returns the build information (Version and Time stamp).
      operationId: getBuildInfo
      responses: 
        '200':
          description: OK
          content: 
            application/json:
              schema:
                $ref: '#/components/schemas/BuildInfo'
      parameters:
        - in: header
          name: LBPATH
          schema:
            type: string
  /countries/{countryId}/cities/{cityId}/showinfo/static:
    get:
      description: Returns a list of static show information for a city.
      operationId: getShowStaticInfo
      responses: 
        '200':
          description: OK
          content: 
            application/json:
              schema:
                $ref: '#/components/schemas/ShowStaticInfo'
      parameters:
        - in: path
          name: countryId
          required: true
          schema:
            type: string
        - in: path
          name: cityId
          required: true
          schema:
            type: string
        - in: header
          name: Accept-Language
          schema:
            type: string
        - in: header
          name: LBPATH
          schema:
            type: string
components:
  schemas:
    BuildInfo:
      properties:
        version:
          type: string
        timestamp:
          type: string
        status:
          type: string
    ShowStaticInfo:
      properties:
        poster:
          $ref: '#/components/schemas/URI'
        time:
          type: integer
          format: int64
        showId:
          type: string
        tags:
          $ref: '#/components/schemas/Set'
        showObjectCreated:
          $ref: '#/components/schemas/HashMap'
peter ivarsson
  • 51
  • 1
  • 1
  • 3
  • Hashmaps: see [Swagger HashMap property type](https://stackoverflow.com/q/16042885/113116) and [Swagger: map of ](https://stackoverflow.com/q/36136885/113116), replacing `definitions` with `components` > `schemas`. – Helen Jan 22 '18 at 14:22
  • 2
    Possible duplicate of [Swagger: map of ](https://stackoverflow.com/questions/36136885/swagger-map-of-string-object) – EdChum Jun 29 '18 at 08:51

0 Answers0