-
-
Notifications
You must be signed in to change notification settings - Fork 528
Not generating types for remote $ref in path parameters #938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
what does the remote file |
This is the common.yaml file, this file is generated from a reference: openapi: 3.1.0
info:
version: 1.0.0
title: Customers Common API Elements
description: Shared OpenAPI Elements used across multiple Customers Domain Services
contact:
name: Company Ltd
url: 'https://www.company.com'
tags:
- name: Customers
components:
parameters:
storeNumber:
name: storeNumber
in: path
required: true
schema:
type: string
pattern: '^\d{4}$'
example: '0123'
description: 'The store number, in four digit format (leading zero padded)'
schemas: {} |
@asda-arantxa-gomez I found a workaround, not sure if this is will be helpful. In the main openapi declaration file: paths:
/customers/{storeNumber}/{customerId}:
parameters:
- schema:
type: string
name: customerId
in: path
required: true
description: customer unique identifier
- $ref: '#/components/parameters/storeNumber' # reference a parameter within the file
components:
parameters:
storeNumber:
in: path # must indicate that parameter is in the path
$ref: './common.yaml#/components/parameters/storeNumber' # local parameter is a proxy for external parameter This workaround will generate the following typescript code that contains the export interface paths {
"/customers/{storeNumber}/{customerId}": {
/** Retrieve the information of the user with the matching user ID. */
get: operations["get-users-userId"];
/** Update the information of an existing user. */
patch: operations["patch-users-userId"];
parameters: {
path: {
/** customer unique identifier */
customerId: string;
storeNumber?: components["parameters"]["storeNumber"];
};
};
};
}
export interface components {
parameters: {
storeNumber: external["common.yaml"]["components"]["parameters"]["storeNumber"];
};
}
export interface external {
"common.yaml": {
paths: {};
components: {
schemas: {};
parameters: {
/** @description The store number, in four digit format (leading zero padded) */
storeNumber: string;
};
};
operations: {};
};
} |
@weiyang-xendit Thank you for your reply. |
This should be fixed in |
Description
When attempting to generate code from an OpenAPI document that included remote $ref as path parameters (storeNumber), these path parameters are ignored when types are generated.
openapi-generator version
5.4.1
node version
14.17.6
OpenAPI declaration file content
Code generated
Issue:
I cannot reference the type
paths['/customers/{storeNumber}/{customerId}]['parameters']['path']['storeNumber']
because it has not been generated.Expected:
Actual:
Similar issue:
#918
The text was updated successfully, but these errors were encountered: