You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes referenced items (that are correctly resolved by Swagger editor) are output as unknown (see example A) and sometimes they are (see example B)
components:
schemas:
# Issue with the resolution of this schemasecondaryNestedSchema:
type: number# This one works finesecondaryRootSchema:
type: stringsecondaryPath:
get:
tags:
- Playlistresponses:
'200':
content:
application/json:
schema:
type: objectproperties:
rootSchema:
$ref: '#/secondaryRootSchema'nestedSchema:
$ref: '#/components/schemas/secondaryNestedSchema'
npx openapi-typescript main.yaml will output:
/** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. */exportinterfacepaths{"/secondary": external["secondary.yaml"]["secondaryPath"];}exporttypewebhooks=Record<string,never>;exporttypecomponents=Record<string,never>;exporttype$defs=Record<string,never>;exportinterfaceexternal{"secondary.yaml": {components: unknown;secondaryRootSchema: string;secondaryPath: {get: {responses: {200: {content: {"application/json": {rootSchema?: external["secondary.yaml"]["secondaryRootSchema"];// Error next line: "Property 'schemas' does not exist on type 'unknown'."nestedSchema?: external["secondary.yaml"]["components"]["schemas"]["secondaryNestedSchema"];};};};};};};};}exporttypeoperations=Record<string,never>;
/** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. */exportinterfacepaths{"/secondary": external["secondary.yaml"]["paths"]["secondaryPath"];}exporttypewebhooks=Record<string,never>;exporttypecomponents=Record<string,never>;exporttype$defs=Record<string,never>;exportinterfaceexternal{"secondary.yaml": {paths: {"secondaryPath": {get: {responses: {200: {content: {"application/json": {// two errors here:// "'rootSchema' is referenced directly or indirectly in its own type annotation."// "'Property 'secondaryRootSchema' does not exist on type..."rootSchema?: external["secondary.yaml"]["secondaryRootSchema"];nestedSchema?: external["secondary.yaml"]["components"]["schemas"]["secondaryNestedSchema"];};};};};};};};webhooks: Record<string,never>;components: {schemas: {secondaryNestedSchema: number;};responses: never;parameters: never;requestBodies: never;headers: never;pathItems: never;};$defs: Record<string,never>;};}exporttypeoperations=Record<string,never>;
Checklist
My OpenAPI schema passes the Redocly validator (npx @redocly/cli@latest lint)1
For the sake of simplicity, I've excluded fields like servers, summary, description, security from the examples, so Redocly warns about it, but I've tested with all the required / recommended fields and the issues still arises. ↩
I'll try to find the source of the issue and to submit a PR but if anyone that has better knowledge of the codebase knows how to fix this, do not wait on me ^^ ↩
The text was updated successfully, but these errors were encountered:
Description
Sometimes referenced items (that are correctly resolved by Swagger editor) are output as
unknown
(see example A) and sometimes they are (see example B)openapi-typescript
6.7.5
20.12.2
Ubuntu 23.10
Reproduction
Example A
main.yaml
secondary.yaml
npx openapi-typescript main.yaml
will output:Example B
main.yaml
secondary.yaml
npx openapi-typescript main.yaml
will output:Checklist
npx @redocly/cli@latest lint
)1Footnotes
For the sake of simplicity, I've excluded fields like
servers
,summary
,description
,security
from the examples, so Redocly warns about it, but I've tested with all the required / recommended fields and the issues still arises. ↩I'll try to find the source of the issue and to submit a PR but if anyone that has better knowledge of the codebase knows how to fix this, do not wait on me ^^ ↩
The text was updated successfully, but these errors were encountered: