Примеры Openapi Springfox 3.0

У меня есть файл yaml с примерами тела запроса. но сгенерированный springfox файл json swagger-ui, созданный springfox, не показывает пример тела запроса, что позволяет отображать пример схемы.

Есть ли обходной путь для отображения примеров тела запроса?

#openapi #swagger-ui #springfox

      
openapi: 3.0.2
info:
  title: Rule APIs
  description: Rule APi
  version: 1.0.0
  contact:
    email: abc@gmail.com

servers:
  - url: 'https://{server}/v1/rule'
    variables:
      server:
        default: localhost
security:
  - BasicAuth: []

paths:

  #####################################################################################################
  ############################  Rule APIs ###############################
  #####################################################################################################

  /rule-set:
    parameters:
      - $ref: '#/components/parameters/XRequestIdHeader'

    post:
      summary: Create a rule set.
      description: Create a rule set.
      operationId: createRule
      tags:
        - Rule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RuleSet'
            example:
              name: My RuleSet
              description: A new ruleSet
              state: enabled
              condition:
                conditionType: ConditionAttributes
                isNegate: false
                dictionaryName: DEVICE
                attributeName: attribute
                operator: equals
                attributeValue: attribute
              serviceName: service
              isProxy: false
      responses:
        '201':
          $ref: '#/components/responses/BadRequest'
        '400':
          $ref: '#/components/responses/BadRequest'

вывод json

0 ответов

Другие вопросы по тегам