Code Monkey home page Code Monkey logo

Comments (12)

jojo1981 avatar jojo1981 commented on July 28, 2024 1

@lube When the answer is sufficient enough, can you please close this issue? Thanks in advanced.

from json-schema.

lube avatar lube commented on July 28, 2024 1

I would but I don't think I can, I didn't open this issue.

from json-schema.

bighappyface avatar bighappyface commented on July 28, 2024 1

Closing as part of clean up.

from json-schema.

lube avatar lube commented on July 28, 2024

+1

from json-schema.

bighappyface avatar bighappyface commented on July 28, 2024

Is the idea that translated error messages would be helpful to developers using this package or for end users of an application using this package?

from json-schema.

lube avatar lube commented on July 28, 2024

The latter of course. The idea is we should have some way to translate the messages for end users without having to fork the project or parse the errors ourselves.

from json-schema.

bighappyface avatar bighappyface commented on July 28, 2024

Error messages provide the property, failing constraint, and constraint details in a consumable format independent of any given language/locale.

For an end-user application I am curious how the user would find value in schema validation error messages over specialized messages focused on the user experience. Printing what in some cases are cryptic messages wouldn't be very helpful to an end user unless the application was a json schema validator like jsonschema.net, but that is my opinion.

If we introduced translated/localized messages, who provides those translations, and what languages/locales would be appropriate? If the language you need is not available, a PR would still be unavoidable, and no PR would be accepted unless all strings were translated.

I believe there are bigger fish to fry for this package, and that there are adequate facilities present in the package to provide package consumers with the ability to integrate validation error into their localized end-user application. That being said, PRs are always welcome.

from json-schema.

jojo1981 avatar jojo1981 commented on July 28, 2024

I agree with @bighappyface that translated/localized messages doesn't belong into the schema. A solution for the problem can be to attach unique error codes to the constraint errors (the current English messages will be untouched). so the library user can map the error codes to there own translated/localized messages. @bighappyface what do you think of this as a solution?

from json-schema.

lube avatar lube commented on July 28, 2024

Great Input @jojo1981 I was thinking something along those lines, not actually providing error strings on different languages, just a more happy way to parse and interface with the schema errors.

from json-schema.

bighappyface avatar bighappyface commented on July 28, 2024

@lube I believe these facilities already exist:

https://github.com/justinrainbow/json-schema/blob/61a95a151aac86eaa9bbd31311d3d12a78c971b8/src/JsonSchema/Constraints/Constraint.php#L85-L89

from json-schema.

lube avatar lube commented on July 28, 2024

@bighappyface You are absolutely correct, the symfony bundle I used, didn't expose the constraints, thanks for taking the time to answer this.

from json-schema.

jojo1981 avatar jojo1981 commented on July 28, 2024

@Reggino When the answer is sufficient enough, can you please close this issue? Thanks in advanced.

from json-schema.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.