Skip to content

Commit

Permalink
update allof description
Browse files Browse the repository at this point in the history
  • Loading branch information
netweng committed Oct 17, 2024
1 parent b08cee0 commit 4d62ba1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cloudtower-api-doc/swagger/utils/wrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ export const wrapSpecWithI18n = (
schema: components.schemas[s],
prefix: ["components", "schemas", s],
describeFn: ({ prefix, path }) => {
const schemaObj = _.get(cloneSpec, prefix);
const type = schemaObj['type'];
if (type === "object") {
if(!schemaObj['properties']) {
_.set(cloneSpec, [...prefix, "title"], prefix[prefix.length - 1]);
} else {
Object.keys(schemaObj['properties']).forEach((key) => {
if(schemaObj['properties'][key]['allOf']) {
const allOfRef = schemaObj['properties'][key]['allOf'][0]['$ref'];
_.set(cloneSpec, [...prefix, "properties", key, "title"], allOfRef.split('/').pop());
}
})
}
}
_.set(cloneSpec, [...prefix, "description"], schema[path]);
},
});
Expand Down

0 comments on commit 4d62ba1

Please sign in to comment.