Skip to content

Commit

Permalink
Merge pull request #1067 from hey-api/fix/named-object-property-no-pr…
Browse files Browse the repository at this point in the history
…operties

fix: handle named object property with no nested properties
  • Loading branch information
mrlubos authored Sep 19, 2024
2 parents 1594663 + 5a52da1 commit cc72738
Show file tree
Hide file tree
Showing 35 changed files with 115 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-carrots-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hey-api/openapi-ts': patch
---

fix: handle named object property with no nested properties
4 changes: 3 additions & 1 deletion packages/openapi-ts/src/openApi/v3/parser/getModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ export const getModel = ({
model.type === 'unknown'
) {
model.export = 'dictionary';
model.name = '[key: string]';
if (!model.name) {
model.name = '[key: string]';
}
}

return model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,11 @@ export const Generic_Schema_Duplicate_Issue_1_System_Boolean_Schema = {
hasError: {
type: 'boolean',
readOnly: true
},
data: {
type: 'object',
properties: {},
additionalProperties: false
}
},
additionalProperties: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1965,6 +1965,11 @@ export const Generic_Schema_Duplicate_Issue_1_System_Boolean_Schema = {
hasError: {
type: 'boolean',
readOnly: true
},
data: {
type: 'object',
properties: {},
additionalProperties: false
}
},
additionalProperties: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1965,6 +1965,11 @@ export const $Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
hasError: {
type: 'boolean',
readOnly: true
},
data: {
type: 'object',
properties: {},
additionalProperties: false
}
},
additionalProperties: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ export type GenericSchemaDuplicateIssue_1_systemBoolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type GenericSchemaDuplicateIssue_1_systemString_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = {
item?: boolean;
error?: (string) | null;
readonly hasError?: boolean;
data?: {
[key: string]: unknown;
};
};

export type Generic_Schema_Duplicate_Issue_1_System_String_ = {
Expand Down
5 changes: 5 additions & 0 deletions packages/openapi-ts/test/spec/v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -3590,6 +3590,11 @@
"hasError": {
"type": "boolean",
"readOnly": true
},
"data": {
"type": "object",
"properties": {},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down

0 comments on commit cc72738

Please sign in to comment.