Giter Club home page Giter Club logo

Comments (8)

whitlockjc avatar whitlockjc commented on August 10, 2024

I've also see the same error in a different part of the code depending on how I loaded the file:

/private/tmp/testing/node_modules/z-schema/src/SchemaCache.js:45
        var keys = Object.keys(schema);
                          ^
RangeError: Maximum call stack size exceeded

If I rewrote the code above to use require to load the JSON files instead of having them inlined for easier testing, this is what I get.

from z-schema.

zaggino avatar zaggino commented on August 10, 2024

Hi @whitlockjc , try with 3.0.2 - updated a minute ago.

from z-schema.

whitlockjc avatar whitlockjc commented on August 10, 2024

That seems to work, no more Maximum call stack exceeded. Thanks a lot.

from z-schema.

whitlockjc avatar whitlockjc commented on August 10, 2024

But...I am now getting unresolved schemas. I assume this is caused by bad references but if you run the above, you will get a plethora of errors:

[ { code: 'UNRESOLVABLE_REFERENCE',
    params: [ 'http://wordnik.github.io/schemas/v1.2/modelsObject.json#' ],
    message: 'Reference could not be resolved: http://wordnik.github.io/schemas/v1.2/modelsObject.json#',
    path: '#/properties/models/additionalProperties' },
  { code: 'UNRESOLVABLE_REFERENCE',
    params: [ 'http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#' ],
    message: 'Reference could not be resolved: http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#',
    path: '#/allOf/0' },
  { code: 'UNRESOLVABLE_REFERENCE',
    params: [ 'http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#' ],
    message: 'Reference could not be resolved: http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#',
    path: '#/allOf/0' },
  { code: 'UNRESOLVABLE_REFERENCE',
    params: [ 'http://wordnik.github.io/schemas/v1.2/oauth2GrantType.json#' ],
    message: 'Reference could not be resolved: http://wordnik.github.io/schemas/v1.2/oauth2GrantType.json#',
    path: '#/definitions/oauth2/properties/grantTypes' },
  { code: 'UNRESOLVABLE_REFERENCE',
    params: [ 'http://json-schema.org/draft-04/schema#' ],
    message: 'Reference could not be resolved: http://json-schema.org/draft-04/schema#',
    path: '#/' },
  { code: 'UNRESOLVABLE_REFERENCE',
    params: [ 'http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#' ],
    message: 'Reference could not be resolved: http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#',
    path: '#/definitions/propertyObject/allOf/1' },
  { code: 'UNRESOLVABLE_REFERENCE',
    params: [ 'http://json-schema.org/draft-04/schema#' ],
    message: 'Reference could not be resolved: http://json-schema.org/draft-04/schema#',
    path: '#/' } ]

from z-schema.

whitlockjc avatar whitlockjc commented on August 10, 2024

The problem is if I alter the id to be just the file name, like using dataTypeBase.json instead of http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#, I get the same thing. I'll talk about this more in #56. Since the call stack issue is fixed, this issue is fixed.

from z-schema.

zaggino avatar zaggino commented on August 10, 2024

Strange, the test for the code above is here and passing: https://github.com/zaggino/z-schema/blob/master/test/ZSchemaTestSuite/Issue57.js

Did I copy something wrong?

from z-schema.

zaggino avatar zaggino commented on August 10, 2024

NOTE: http://json-schema.org/draft-04/schema is automatically resolved for all tests as it's a standard schema: https://github.com/zaggino/z-schema/blob/master/test/spec/ZSchemaTestSuiteSpec.js#L77-L78

from z-schema.

whitlockjc avatar whitlockjc commented on August 10, 2024

In my last comment, I mentioned that the code above was fine but the code in #56 was bad. I think we're good here. Sorry for the confusion.

from z-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.