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

fix(config): fix identifier field validation #1882

Merged
merged 1 commit into from
Nov 22, 2018
Merged

Conversation

erquhart
Copy link
Contributor

Summary

Schema for validating identifier_field for a collection was incorrect.

Fixes #1874.

@verythorough
Copy link
Contributor

verythorough commented Nov 16, 2018

Deploy preview for netlify-cms-www ready!

Built with commit 62c82a2

https://deploy-preview-1882--netlify-cms-www.netlify.com

@erquhart erquhart force-pushed the fix-identifier-schema branch 2 times, most recently from ff042f2 to 5043a67 Compare November 16, 2018 21:04
@verythorough
Copy link
Contributor

verythorough commented Nov 16, 2018

Deploy preview for cms-demo ready!

Built with commit 62c82a2

https://deploy-preview-1882--cms-demo.netlify.com

@erquhart erquhart force-pushed the fix-identifier-schema branch from 5043a67 to 62c82a2 Compare November 19, 2018 16:59
@erquhart
Copy link
Contributor Author

erquhart commented Nov 19, 2018

Learned two things:

  1. AJV is an incredibly versatile tool for JSON schema validation. Introducing it stepped our config validation game way up.
  2. AJV is pretty difficult to grok without learning their API.

Considering that we now accept config direct from JS and not just from YAML/JSON files, it's fair to say we no longer require a JSON-specific validator, which means joi, the object schema validator from the Hapi devs, is now an option 🎉

To temporarily fix this bug, I've gone ahead and removed validation for identifier fields. Moving forward, I have a 75% complete joi implementation that will go to PR once hapijs/joi#1650 and hapijs/joi#1656 are resolved.

@erquhart erquhart merged commit fe6af19 into master Nov 22, 2018
@erquhart erquhart deleted the fix-identifier-schema branch November 22, 2018 03:32
LoicMahieu added a commit to LoicMahieu/netlify-cms that referenced this pull request Nov 29, 2018
* official/master: (42 commits)
  chore: improve publish scripts
  Publish
  chore: test before publishing
  chore(netlify-cms-core): upgrade react-dnd to 7.x (decaporg#1922)
  chore(netlify-cms-widget-text): upgrade to react-textarea-autosize 7.x (decaporg#1921)
  chore(netlify-cms-core): upgrade to react-waypoint 8.x (decaporg#1920)
  fix(backend): use singular label in custom commit message (decaporg#1917)
  docs: add GAE-specific oAuth client (decaporg#1918)
  fix(netlify-cms-widget-text): set correct font family (decaporg#1916)
  chore(netlify-cms-core): upgrade redux and related dependencies (decaporg#1914)
  chore(dependencies): bump npm-run-all (decaporg#1913)
  fix(netlify-cms-core): fix identifier field validation (decaporg#1907)
  docs: improve widget custom validation sample (decaporg#1911)
  improvement(backends): changes for registerBackend compatibility (decaporg#1880)
  fix(netlify-cms-core): fix prop-types warnings (decaporg#1906)
  fix(a11y): correct label "for" references to fields (decaporg#1904)
  improvement(netlify-cms-core): wrap navigations in lists for better a11y (decaporg#1903)
  fix(netlify-cms-widget-markdown): add missing border radius on toolbar (decaporg#1905)
  fix(netlify-cms-core): remove double focusable elements on profile menu button (decaporg#1900)
  fix(config): remove identifier field validation (decaporg#1882)
  ...
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.

Specifying a custom identifier_field is considered invalid.
2 participants