Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,23 @@ private void flattenContent(Content content, String name) {
if (schema == null) {
continue;
}
String schemaName = resolveModelName(schema.getTitle(), name); // name example: testPost_request
// Check if schema has a $ref pointing to a component schema
// If so, prefer the referenced schema name over operation-based naming
String schemaName;
if (schema.get$ref() != null) {
String refName = ModelUtils.getSimpleRef(schema.get$ref());
if (refName != null && openAPI.getComponents() != null &&
openAPI.getComponents().getSchemas() != null &&
openAPI.getComponents().getSchemas().containsKey(refName)) {
// Use the referenced schema name instead of operation-based name
schemaName = resolveModelName(schema.getTitle(), refName);
} else {
// Fallback to original behavior if ref doesn't point to a component schema
schemaName = resolveModelName(schema.getTitle(), name);
}
} else {
schemaName = resolveModelName(schema.getTitle(), name); // name example: testPost_request
}
// Recursively gather/make inline models within this schema if any
gatherInlineModels(schema, schemaName);
if (isModelNeeded(schema)) {
Expand Down
4 changes: 4 additions & 0 deletions samples/client/echo_api/typescript-axios/build/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export const BodyApiAxiosParamCreator = function (configuration?: Configuration)
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
const allowsAnonymous = true;

localVarHeaderParameter['Accept'] = 'image/gif';

Expand Down Expand Up @@ -354,6 +355,7 @@ export const BodyApiAxiosParamCreator = function (configuration?: Configuration)
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
const allowsAnonymous = true;

localVarHeaderParameter['Content-Type'] = 'application/octet-stream';
localVarHeaderParameter['Accept'] = 'text/plain';
Expand Down Expand Up @@ -390,6 +392,7 @@ export const BodyApiAxiosParamCreator = function (configuration?: Configuration)
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
const allowsAnonymous = true;

if (files) {
files.forEach((element) => {
Expand Down Expand Up @@ -430,6 +433,7 @@ export const BodyApiAxiosParamCreator = function (configuration?: Configuration)
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
const allowsAnonymous = true;


if (myFile !== undefined) {
Expand Down
Loading