feat: enhance TagOperation interface with detailed parameter structure and update return type handling in generator
This commit is contained in:
@@ -188,7 +188,13 @@ export function generateCleanArchitecture(
|
|||||||
Object.keys(tagsMap).forEach((tag) => {
|
Object.keys(tagsMap).forEach((tag) => {
|
||||||
const imports: { classname: string; classFilename: string; classVarName: string }[] = [];
|
const imports: { classname: string; classFilename: string; classVarName: string }[] = [];
|
||||||
Object.keys(schemas).forEach((s) => {
|
Object.keys(schemas).forEach((s) => {
|
||||||
if (tagsMap[tag].some((op) => op.returnType === s || op.returnType === `Array<${s}>`)) {
|
const usedAsReturn = tagsMap[tag].some(
|
||||||
|
(op) => op.returnType === s || op.returnType === `Array<${s}>`
|
||||||
|
);
|
||||||
|
const usedAsParam = tagsMap[tag].some((op) =>
|
||||||
|
op.allParams.some((p) => p.dataType === s || p.dataType === `Array<${s}>`)
|
||||||
|
);
|
||||||
|
if (usedAsReturn || usedAsParam) {
|
||||||
imports.push({
|
imports.push({
|
||||||
classname: s,
|
classname: s,
|
||||||
classFilename: toCamelCase(s),
|
classFilename: toCamelCase(s),
|
||||||
|
|||||||
@@ -65,13 +65,21 @@ export interface OpenApiOperation {
|
|||||||
* Operación normalizada y lista para ser consumida por los templates Mustache.
|
* Operación normalizada y lista para ser consumida por los templates Mustache.
|
||||||
* Cada instancia representa un endpoint agrupado bajo un tag del API.
|
* Cada instancia representa un endpoint agrupado bajo un tag del API.
|
||||||
*/
|
*/
|
||||||
|
export interface TagOperationParam {
|
||||||
|
paramName: string;
|
||||||
|
dataType: string;
|
||||||
|
description: string;
|
||||||
|
required: boolean;
|
||||||
|
'-last': boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TagOperation {
|
export interface TagOperation {
|
||||||
nickname: string;
|
nickname: string;
|
||||||
summary: string;
|
summary: string;
|
||||||
notes: string;
|
notes: string;
|
||||||
httpMethod: string;
|
httpMethod: string;
|
||||||
path: string;
|
path: string;
|
||||||
allParams: unknown[];
|
allParams: TagOperationParam[];
|
||||||
hasQueryParams: boolean;
|
hasQueryParams: boolean;
|
||||||
queryParams: unknown[];
|
queryParams: unknown[];
|
||||||
hasBodyParam: boolean;
|
hasBodyParam: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user