Skip to content

Commit

Permalink
feat: support for enum methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ratik committed Dec 12, 2023
1 parent e5cfd9b commit c9cdb59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
}
}
8 changes: 4 additions & 4 deletions src/schemaToTs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const fixEnum = (o: JSONSchema4) => {
};

const fixEmptyEnums = (o: KVJsonSchema) => {
for (const [k, dVal] of Object.entries(o)) {
for (const [, dVal] of Object.entries(o)) {
fixEnum(dVal);
}
return o;
Expand Down Expand Up @@ -117,11 +117,11 @@ export class Client {
definitions = { ...definitions, ...(file.query as any).definitions };
let wasRequired = false;
for (const query of file.query.oneOf) {
const queryName = query.required[0];
const queryName = query.required ? query.required[0] : query.enum[0];
const outType = queryMap[queryName];
const inType = query.properties[queryName];
const inType = query.properties && query.properties[queryName];
log('generating query', queryName);
if (inType.required) {
if (inType && inType.required) {
wasRequired = true;
const compType = {
...inType,
Expand Down

0 comments on commit c9cdb59

Please sign in to comment.