Skip to content

Unknown type not being treated as 'any' #47

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

Closed
wants to merge 1 commit into from
Closed

Unknown type not being treated as 'any' #47

wants to merge 1 commit into from

Conversation

robbrit
Copy link

@robbrit robbrit commented Nov 28, 2012

According to draft 3, if type of a value is not in the list of specified types then any type is valid: http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1

Useful for BSON-based databases like MongoDB which have some extra types like ObjectId.

@Julian
Copy link
Member

Julian commented Nov 28, 2012

Hey. OK, this sounds reasonable. I read that line in the draft as saying that the validator doesn't have to complain about {"type" : "whatever"} if it doesn't know what "whatever"s are, but I see that the type property defaults to "any", so that makes me see you're right anyhow, since having "type" : "any" should apparently have the same behavior as not having type at all.

That being said I don't think is_type should be changed. This change belongs in validate_type.

@robbrit
Copy link
Author

robbrit commented Nov 28, 2012

Ah, yeah good call. I will make those tweaks and let you know.

@Julian Julian closed this Nov 28, 2012
@Julian Julian reopened this Nov 28, 2012
@Julian
Copy link
Member

Julian commented Nov 28, 2012

Awesome, thanks.

(And sorry, didn't mean to close, GitHub was being dumb)

@Julian Julian closed this in f571a54 Dec 30, 2012
@Julian
Copy link
Member

Julian commented Dec 30, 2012

Hey. This should be fixed in the linked commit. Thanks.

@robbrit
Copy link
Author

robbrit commented Dec 30, 2012

Great, thanks! Had been meaning to make the tweaks to validate_type but was having some trouble following the code. Also the project involving the JSON Schema stuff fell on the back-burner for the time being.

@Julian
Copy link
Member

Julian commented Dec 30, 2012

No worries. It's a bit hairy, but such is life.
On Dec 30, 2012 12:47 PM, "Rob" [email protected] wrote:

Great, thanks! Had been meaning to make the tweaks to validate_type but
was having some trouble following the code. Also the project involving the
JSON Schema stuff fell on the back-burner for the time being.


Reply to this email directly or view it on GitHubhttps://github.com//pull/47#issuecomment-11766841.

Julian added a commit that referenced this pull request Feb 20, 2014
0ba6722 As per the spec, only dotted-quad is an acceptable format for IPv4 addresses.
6c3ca30 Merge pull request #51 from ericgj/add/validator
9cbcd43 Merge pull request #50 from ericgj/add/not-blank-schema-test
78bccaf add json-schema-valid to list of validators
4fe00e9 add 'forbidden property' test (not with blank schema)
cd2aa75 Merge pull request #49 from Acubed/develop
1186813 Add the enum/required test to draft4 too
30ca2fd Add tests for required/not required values with enums
ae3050a Add Jsonary and tv4 to the list
6c02fd0 Merge pull request #47 from iclanzan/patch-1
dff064d Added Jassi library to the list.

git-subtree-dir: json
git-subtree-split: 0ba672265758f09405b14a6508ff696a35e857ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something doesn't work the way it should.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants