Swagger editor converter fails to convert nested properties from 2.0 to 3.x
johansenja opened this issue · comments
Q&A
- OS: macOS
- Browser: Firefox 120.0b8
- Version: N/A
- Method of installation: N/A
- Swagger-Editor version: The version currently [2024-01-12] on https://editor-next.swagger.io/ and https://editor.swagger.io/
- Swagger/OpenAPI version: 2.0 to 3.x
Content & configuration
Example Swagger/OpenAPI definition: https://pastebin.com/dbRtCgJF (too long for GH issue otherwise)
Swagger-Editor configuration options:
Default from https://editor-next.swagger.io/ and https://editor.swagger.io/
Describe the bug you're encountering
When converting from swagger 2.0 to openApi 3.x, none of the properties of the "200"
response type (apart from the basic top-level ones) are converterd - it simple gives all the top level properties (transactionDetail
, inquiryDetail
, blockStatus
, organization
) as object
s with additionalProperties: true
Output
openapi: 3.0.1
info:
title: Data Blocks
description: The Data Block API is intended to vend Data Blocks to customers transactionally
based on a request for a single DUNS.
version: "1"
servers:
- url: https://plus.dnb.com/
paths:
/v1/data/duns/{dunsNumber}:
get:
tags:
- dataBlocks
summary: Endpoint
description: The Data Block API is intended to vend Data Blocks to customers
transactionally based on a request for a single DUNS.
operationId: dataBlocks
parameters:
- name: Authorization
in: header
description: The access token provided by authentication.
required: true
schema:
type: string
example: Bearer alphanumerictoken
- name: dunsNumber
in: path
description: A 9-character numeric string identifying the entity by its Dun
& Bradstreet D-U-N-S number.
required: true
schema:
type: string
example: "804735132"
- name: blockIDs
in: query
description: "The block ID provided by Dun & Bradstreet that identifies the\
\ data block to be returned.<br/><br/>Multiple values can be included, separated\
\ by commas."
required: true
schema:
type: string
example: blockID
- name: tradeUp
in: query
description: "Indicates if the Headquarters D-U-N-S Number should be returned\
\ if a Branch is requested.<br/><br/>Valid values:<br/>* hq: If the provided\
\ D-U-N-S Number is a Branch, the Headquarter D-U-N-S Number is returned.<br/>*\
\ domhq: If the provided D-U-N-S Number is a Branch, the Domestic Headquarter\
\ D-U-N-S Number is returned.<br/><br/>If the requested D-U-N-S Number is\
\ not a Branch, that D-U-N-S Number will be returned regardless of the value\
\ of this parameter.<br/><br/>If the parameter is omitted, the requested\
\ D-U-N-S Number is returned even if it is a Branch."
schema:
type: string
example: hq
- name: customerReference
in: query
description: Up to 240 characters for a reference string to be linked to the
request in order to support subsequent order reconciliation.
schema:
type: string
example: customer reference text
responses:
"200":
description: OK
content:
application/json;charset=utf-8:
schema:
type: object
properties:
transactionDetail:
type: object
additionalProperties: true
description: The information used to process this request.
inquiryDetail:
type: object
additionalProperties: true
description: The criteria used to process this request.
blockStatus:
type: array
description: Records the status of the data blocks requested by
the customer.
items:
type: object
additionalProperties: true
organization:
type: object
additionalProperties: true
description: The details of the entity.
description: ""
"301":
description: Moved Permanently
headers:
location:
description: The URL to retrieve the D-U-N-S Number to which the requested
D-U-N-S Number was transferred.
schema:
type: string
content:
application/json;charset=utf-8:
schema:
type: object
description: ""
security: []
x-monitoring: "Available except \"Business Activity Insights\", \"Derived Trade\
\ Insights\", \"Inquiry Insights\", \"Company Information Advanced Geoposition\
\ Side Block\", \"Hierarchies & Connections ELI Side Block\". Please refer\
\ <a href=\"/html/guides/Monitor/DataProducts.html\" target=\"_blank\">guide</a>\
\ for details."
x-monitoring-pdf: "Available except \"Business Activity Insights\", \"Derived\
\ Trade Insights\", \"Inquiry Insights\", \"Company Information Advanced Geoposition\
\ Side Block\", \"Hierarchies & Connections ELI Side Block\". Please refer\
\ guide for details."
x-DNB-Name: "Data Blocks (companyinfo_L1_v1, hierarchyconnections_L1_v1)"
x-DNB-ID: dataBlocks
components: {}
x-original-swagger-version: "2.0"
Steps to reproduce the behavior:
- Go to https://editor-next.swagger.io/ or https://editor.swagger.io/ (behaviour is the same)
- Paste the sample from above
- Click on Edit > Convert to OpenAPI 3.x
- See output (most of the properties are gone)
Expected behavior
The converter converts all properties - or at least gives an error/feedback if the schema is incorrect (though it seems to parse and display the properties OK from the 2.0 version, which suggests that the input is valid
![Screenshot 2024-01-12 at 10 42 32](https://private-user-images.githubusercontent.com/43235608/296211707-890e5ac8-09d3-4b43-bcda-40220318010a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDU1NzQzNjksIm5iZiI6MTcwNTU3NDA2OSwicGF0aCI6Ii80MzIzNTYwOC8yOTYyMTE3MDctODkwZTVhYzgtMDlkMy00YjQzLWJjZGEtNDAyMjAzMTgwMTBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTE4VDEwMzQyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFkNTc3YTliNWU3OWMxN2IzNDY5MmE1MmU5N2Q2ZDEyZGViNTBmMTNjZWJmMmZmMGUzMDgwOGY3MGExNWYyNDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.IC8SQ8uMbxDZ2C4v_ZUp91JI9XyyISmCRi5YhYJHBvY)