Skip to content

Update filetypes schema to require leading period. #59

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

Merged
merged 1 commit into from
Mar 6, 2017

Conversation

Psykar
Copy link
Contributor

@Psykar Psykar commented Mar 6, 2017

No description provided.

@Psykar
Copy link
Contributor Author

Psykar commented Mar 6, 2017

It's worth nothing your existing schema there was broken according to the spec it seems.
I'm sure this one can be expanded later if required.

@gajus
Copy link
Owner

gajus commented Mar 6, 2017

Correct me if I am wrong, but it should be:

"patternProperties": {
    "\\..*": {"type": "string"}
},
"patternRequired": ["\\..*"]

@Psykar
Copy link
Contributor Author

Psykar commented Mar 6, 2017

I won't claim to know json schema layouts. But the above threw an error correctly when I left a period off filetypes in my config saying the schema didn't pass.

I can try adding a unit test if you'd prefer? I just threw this together quickly.

@Psykar
Copy link
Contributor Author

Psykar commented Mar 6, 2017

This page : http://json-schema.org/example2.html
has the following

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "/": {}
    },
    "patternProperties": {
        "^(/[^/]+)+$": {}
    },
    "additionalProperties": false,
    "required": [ "/" ]
}

And their spiel matches what I'd expect.

@gajus gajus merged commit 629e009 into gajus:master Mar 6, 2017
@gajus
Copy link
Owner

gajus commented Mar 6, 2017

Thank you

@Psykar Psykar deleted the bugfix/filetype-schema branch March 6, 2017 05:19
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

Successfully merging this pull request may close these issues.

2 participants