Coder Social home page Coder Social logo

jamesmessinger / json-schema-lib Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 2.0 580 KB

Extensible JSON Schema library with support for multi-file schemas using $ref

License: MIT License

JavaScript 98.23% HTML 1.77%
json-schema json-reference json-pointer resolver parser validation validator javascript nodejs universal-javascript

json-schema-lib's People

Contributors

jamesmessinger avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

json-schema-lib's Issues

File paths with URI-encoded character codes get decoded to invalid filenames

Hello! ๐Ÿ‘‹

Preface

I know that this library is still in pre-alpha and very much not ready for production, but I've been looking into using it anyway because my code is currently reliant on using deasync to force json-schema-ref-parser to behave in a synchronous manner, and deasync is causing segfaults (!) so I need to migrate my code to something else as soon as I can.

I specifically only need synchronous parsing of local files. I don't use any remote schemas that require HTTP requests.

The Actual Issue

During my testing of json-schema-lib, I noticed FileSystemPlugin.js#L150, which calls decodeURIComponent on the file path. Was this meant to be encodeURIComponent, instead of decode?

I have some files such as schema%3Astate.json which are already URI encoded. But, when passing these paths to json-schema-lib, the paths gets decoded such that they are now pointing to files that don't exist. For example: schema%3Astate.json becomes schema:state.json, which is not a valid Windows filename.

If this is indeed unintended behavior, I would be happy to open a small pull request to change it.

Thanks for all your work on both this and the original json-schema-ref-parser!

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.