Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-996

OpenAPI: Fix invalid swagger schema

XMLWordPrintable

      In DefinitionNames we are trying to pick a number discriminator when we have the same parameters in path. Unfortunately, this logic produces invalid schemas.

      It means that we have pair-key1 in URL but pair-key in parameters. The most probable reason is that logic is not taking into account that it has to be executed for each request separately.

      The error:

      Semantic error at paths./rests/data/aaa-app-config:shiro-configuration/urls={pair-key1}.patch.parameters.0.name
      Path parameter "pair-key" must have the corresponding {pair-key} segment in the "/rests/data/aaa-app-config:shiro-configuration/urls={pair-key1}" path
      Jump to line 1589

      The corresponding fragment:

       /rests/data/aaa-app-config:shiro-configuration/urls={pair-key1}:
          patch:
            description: The urls section of shiro.ini.
            summary: PATCH - aaa-app-config - urls
            tags:
              - controller aaa-app-config
            requestBody:
              content:
                application/yang-data+json:
                  schema:
                    $ref: '#/components/schemas/aaa-app-config_shiro-configuration_config_urls_TOP'
                application/yang-data+xml:
                  schema:
                    $ref: '#/components/schemas/aaa-app-config_shiro-configuration_config_urls'
              description: urls_config
            parameters:
              - name: pair-key
                description: The key.
                schema:
                  type: string
                in: path
                required: true
              - name: pair-key1
                description: The key.
                schema:
                  type: string
                in: path
                required: true
            responses:
              '200':
                description: OK
              '204':
                description: Updated

      If you scroll up in full schema you can see at line 1452:

      /rests/data/aaa-app-config:shiro-configuration/main={pair-key}:

      The full schema can be seen when you insert content of http://localhost:8181/apidoc/openapi3/apis/single into https://editor.swagger.io/.

            yaroslav.lastivka Yaroslav Lastivka
            ivanhrasko Ivan Hrasko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: