Swagger Editor 3.0如何为java地图编写组件模式

时间:2018-01-22 14:09:48

标签: validation yaml swagger-editor openapi

我有一个包含java URI,Set和Map的响应模式。 我找不到任何关于如何为这个yaml部分编码为swagger的示例。
如何在yaml组件中编写URI,Set和Map部分:schemas:见下文。

我的回复java代码如下所示。

public class ShowStaticInfo {

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

这样写的yaml代码。 如上所述,这个yaml需要改变。

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'

0 个答案:

没有答案