Giter Site home page Giter Site logo

Resolving JSON schema failing about speccy HOT 5 CLOSED

wework avatar wework commented on July 19, 2024
Resolving JSON schema failing

from speccy.

Comments (5)

MikeRalphson avatar MikeRalphson commented on July 19, 2024

Do you get a warning if you specify --verbose?

from speccy.

simondean avatar simondean commented on July 19, 2024

Just checked and yes there's a warning if I specify --verbose

Without verbose:

$ node_modules/.bin/speccy lint openapi.yaml
Specification schema is invalid.

#/paths/~1example/get/responses/200/content/application~1json
expected '{\n  "type": "object"\n  "properties": {\n    "example": {\n      "type": "string"\n    }\n  }\n}\n' to be an object
    expected '{\n  "type": "object"\n  "properties": {\n    "example": {\n      "type": "string"\n    }\n  }\n}\n' to have type object
        expected 'string' to be 'object'

With verbose:

$ node_modules/.bin/speccy lint openapi.yaml --verbose
GET openapi.yaml
GET example-schema.json 
{ YAMLException: missed comma between flow collection entries at line 3, column 3:
      "properties": {
      ^
    at generateError (node_modules/js-yaml/lib/js-yaml/loader.js:165:10)
    at throwError (node_modules/js-yaml/lib/js-yaml/loader.js:171:9)
    at readFlowCollection (node_modules/js-yaml/lib/js-yaml/loader.js:691:7)
    at composeNode (node_modules/js-yaml/lib/js-yaml/loader.js:1333:11)
    at readBlockMapping (node_modules/js-yaml/lib/js-yaml/loader.js:1009:16)
    at composeNode (node_modules/js-yaml/lib/js-yaml/loader.js:1332:12)
    at readDocument (node_modules/js-yaml/lib/js-yaml/loader.js:1492:3)
    at loadDocuments (node_modules/js-yaml/lib/js-yaml/loader.js:1548:5)
    at load (node_modules/js-yaml/lib/js-yaml/loader.js:1569:19)
    at Object.safeLoad (node_modules/js-yaml/lib/js-yaml/loader.js:1591:10)
  name: 'YAMLException',
  reason: 'missed comma between flow collection entries',
  mark: 
   Mark {
     name: null,
     buffer: '{\n  "type": "object"\n  "properties": {\n    "example": {\n      "type": "string"\n    }\n  }\n}\n\u0000',
     position: 23,
     line: 2,
     column: 2 },
  message: 'missed comma between flow collection entries at line 3, column 3:\n      "properties": {\n      ^' }
Creating initial clone of data at #/paths/~1example/get/responses/200/content/application~1json/schema
Finished resolution! 
Found 14 rules: parameter-description,operation-operationId,operation-summary-or-description,operation-tags,server-trailing-slash,openapi-tags,openapi-tags-alphabetical,reference-no-other-properties,example-value-or-externalValue,reference-components-regex,no-script-tags-in-markdown,info-contact,license-apimatic-bug,no-eval-in-descriptions
Specification schema is invalid.

#/paths/~1example/get/responses/200/content/application~1json
expected '{\n  "type": "object"\n  "properties": {\n    "example": {\n      "type": "string"\n    }\n  }\n}\n' to be an object
    expected '{\n  "type": "object"\n  "properties": {\n    "example": {\n      "type": "string"\n    }\n  }\n}\n' to have type object
        expected 'string' to be 'object'

from speccy.

philsturgeon avatar philsturgeon commented on July 19, 2024

I'm gonna punt this one off to @MikeRalphson I think 😛

from speccy.

MikeRalphson avatar MikeRalphson commented on July 19, 2024

I'll make a note to look into whether the target of a $ref can ever be other than json or yaml in the upcoming release of openapi-kit, but for now I'll expose those warnings even when verbose isn't set.

from speccy.

philsturgeon avatar philsturgeon commented on July 19, 2024

This has been solved through improving error messages in #37. Thank you @MikeRalphson!

from speccy.

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.