Skip to content

[Fix #3] Implement Attribute Name Validation #61

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 6 commits into from
Oct 8, 2017

Conversation

francislavoie
Copy link
Contributor

@francislavoie francislavoie commented Oct 8, 2017

Fixes #3

Explanation/example of the regex: https://regex101.com/r/KreIvw/2

  • Has a positive lookahead to reject -, _, at the start
  • Has a positive lookbehind to reject -, _, at the end
  • Matches a-z, A-Z, 0-9, all unicode from 0080 to FFFF and -, _,

Wrote a couple tests, they're kinda random cases that could probably be cleaned up, but I think it should cover the majority of possibilities.

http://jsonapi.org/format/#document-member-names

@francislavoie francislavoie changed the title (Fix #3) Implement Attribute Name Validation [Fix #3] Implement Attribute Name Validation Oct 8, 2017
@f3ath f3ath merged commit bb65a43 into json-api-php:master Oct 8, 2017
@f3ath
Copy link
Contributor

f3ath commented Oct 8, 2017

That's pretty cool, thanks @francislavoie!

@francislavoie francislavoie deleted the patch-1 branch October 8, 2017 03:55
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