There is a discrepancy between the Apidog UI/Code Generation preview and the actual exported OpenAPI YAML/JSON file. While a schema referenced within an array (e.g., type: array, items: { $ref: '...' }) displays correctly as a reference in the “Preview” and “Code Generation” tabs, the exported file converts this reference into an inline object.
Expected Behavior
The exported YAML should maintain the reference for array items:
Hello, thank you for your feedback. We were unable to reproduce this issue locally—the exported OpenAPI file correctly preserves the $ref reference in array items.
To help us investigate further, please provide the following information:
Screenshot of the export entry point
For example: Is it from “Settings → Export” or “APIs → Export”?
Are you using “Export” or “Open URL”?
JSON Schema of the interface
Include the array items configuration with the $ref reference
Export the interface in Apidog format
This will help us view the complete data structure
Thank you for your cooperation. We will investigate and address this as soon as we receive the information.
@apidog
Thanks for your quick response.
Here are some screenshots showing the items inside the array are in fact a reference but not perserved after an export. And the apidog export so you can reproduce it.
In the example I just export the folder from the sidebar (I didn’t know there is a difference).
Example Schema referencing another PagenationMetadata and User inside an array:
Hello @Tommy, thank you for the detailed information. We’ve identified the issue:
Your response body root node is using Apidog’s internal reference mechanism (x-apidog-refs) via the “Add” button. During OpenAPI export, this causes array items’ $ref references to be inlined as full object structures.
Solution: For the response body root node, directly reference the data model by:
My workflow is to select ‘Object’, add a child node, and click Reference Schema next to the field name. Should this result in the same outcome, or is it intentional different?