-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: determine type of combinedKeywords #237
Conversation
Pull Request Test Coverage Report for Build 7673994061
💛 - Coveralls |
@@ -224,7 +224,9 @@ describe('S', () => { | |||
}) | |||
|
|||
describe('compose keywords', () => { | |||
const ajv = new Ajv() | |||
const ajv = new Ajv({ | |||
allowUnionTypes: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because ajv will warn and spam the log output, because here type will be integer and string.
properties: { foo: { type: 'string', anyOf: [{ type: 'string' }] } }, | ||
type: 'object' | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a similar test for oneOf?
Looking at the change, this seems counterintuitive. Why specifying the same thing twice? |
I just implemented it to fix the reported issue. If ajv strict is warning, because type is missing, then i guess it needs to be added, even if it is twice. Should I continue on this PR or should we wait for more feedback? |
Looking at it, it doesn't seems something we should fix. I've actually never used type with anyOf. |
I've not found any JSONSchema specs that actually requires "type" with oneOf/anyOf.. maybe we should consider raising #233 on AJV side? |
Closing due to inactivity. |
I've been waiting for some reply on this.. I have still a lot of spam in my logs for this issue.. |
https://json-schema.org/understanding-json-schema/reference/combining#factoringschemas
|
Resolves #233
Checklist
npm run test
andnpm run benchmark
and the Code of conduct