Skip to content

Commit

Permalink
fix(scalar): better handling object properties with additionalProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
anymaniax committed Feb 18, 2022
1 parent 7174cd0 commit 44b6c4e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/core/getters/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,19 @@ export const getObject = async ({
acc.schemas.push(...resolvedValue.schemas);

if (arr.length - 1 === index) {
acc.value += '\n}';
}

if (item.additionalProperties) {
if (isBoolean(item.additionalProperties)) {
acc.value += ` & { [key: string]: any }`;
if (item.additionalProperties) {
if (isBoolean(item.additionalProperties)) {
acc.value += `\n [key: string]: any;\n }`;
} else {
const resolvedValue = await resolveValue({
schema: item.additionalProperties,
name,
context,
});
acc.value += `\n [key: string]: ${resolvedValue.value};\n}`;
}
} else {
const resolvedValue = await resolveValue({
schema: item.additionalProperties,
name,
context,
});
acc.value += ` & {[key: string]: ${resolvedValue.value}}`;
acc.value += '\n}';
}
}

Expand Down

1 comment on commit 44b6c4e

@vercel
Copy link

@vercel vercel bot commented on 44b6c4e Feb 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.