Skip to content
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

Allow no-property schemas #6

Open
mattbishop opened this issue Jun 7, 2019 · 2 comments
Open

Allow no-property schemas #6

mattbishop opened this issue Jun 7, 2019 · 2 comments
Assignees

Comments

@mattbishop
Copy link

I want to create a schema that validates an object has NO properties, like this:

class EmptyObjectSchema {
}
getJSONSchema(EmptyObjectSchema) <-- throws Error: No schema properties found on class.
@mattbishop
Copy link
Author

It would generate this schema:

{
  "type": "object",
  "properties": {
  }
}

@leetm4n leetm4n self-assigned this Jun 7, 2019
@wigy-opensource-developer

Yeah. Maybe if that helps implementing this feature, getJSONSchema could get default options for properties, objects and arrays. Something like getJSONSchema(EmptyObjectSchema, {property: {required: true}})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants