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

Missing/empty "properties" object not supported #1

Open
atombender opened this issue Sep 12, 2018 · 1 comment
Open

Missing/empty "properties" object not supported #1

atombender opened this issue Sep 12, 2018 · 1 comment

Comments

@atombender
Copy link

This is not accepted:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "https://example.com/myschema",
  "type": "object",
  "properties": {
    "foo": {
      "type": "object"
    }
  }
}

Fails with:

schema type has no properties: "myschema/foo" (root=false)

But JSON Schema allows this:

6.5.4.  properties
[...]
   Omitting this keyword has the same behavior as an empty object.

The spec also allows properties that have no type, which means "any type":

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

but that is also not supported by jsonschema2go.

(In JSON Schema, objects are "open" by default — validation ignores properties not mentioned by the schema. To "close" objects, you have to set additionalProperties to false, something that is also not supported by jsonschema2go.)

@fiorix
Copy link
Owner

fiorix commented Sep 16, 2018

I wonder what kind of object that'll be in Go. Is it interface{} ?

Like I stated in the README, this is an incomplete implementation and many things aren't supported.

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

2 participants