[NETCONF-1022] OpenApi: Missing required parameters in swagger schema Created: 10/May/23  Updated: 31/May/23  Resolved: 31/May/23

Status: Resolved
Project: netconf
Component/s: restconf-openapi
Affects Version/s: None
Fix Version/s: 6.0.0, 4.0.7, 5.0.7

Type: Bug Priority: Medium
Reporter: Yaroslav Lastivka Assignee: Yaroslav Lastivka
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Errors in SwaggerEditor.png     File aaa-cert-mdsal@2016-03-21.yang     File network-topology@2013-10-21.yang    
Issue Links:
Blocks
blocks NETCONF-996 OpenAPI: Fix invalid swagger schema Resolved

 Description   

Logic of BaseYangOpenApiGenerator#addPaths creates an invalid schema for models which contain lists with nested containers. We don't have the required path parameters according to the declared parameters in the request.
The error: 

Semantic error at paths./rests/data/aaa-cert-mdsal:key-stores/ssl-data={bundle-name}/trust-keystoreDeclared path parameter "bundle-name" needs to be defined as a path parameter at either the path or operation level 

The corresponding fragment:

  /rests/data/aaa-cert-mdsal:key-stores/ssl-data={bundle-name}/trust-keystore:
    patch:
      description: ''
      summary: PATCH - aaa-cert-mdsal - trust-keystore
      tags:
        - controller aaa-cert-mdsal
      requestBody:
        content:
          application/yang-data+json:
            schema:
              $ref: '#/components/schemas/aaa-cert-mdsal_key-stores_ssl-data_config_trust-keystore_TOP'
          application/yang-data+xml:
            schema:
              $ref: '#/components/schemas/aaa-cert-mdsal_key-stores_ssl-data_config_trust-keystore'
        description: trust-keystore_config
      parameters: []
      responses:
        '200':
          description: OK
        '204':
          description: Updated

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

 


Generated at Wed Feb 07 20:16:29 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.