cvent / json-schema-deref-sync

Synchronous json schema dereference utility
http://bojand.github.io/json-schema-deref-sync
MIT License
35 stars 24 forks source link

It just does not work. #25

Closed akimkelar closed 5 years ago

akimkelar commented 5 years ago

1) What version of the module is the issue happening on? Does the issue happen on latest version? "json-schema-deref-sync": "^0.10.1" 2) What platform and Node.js version? (For example Node.js 0.12 on Mac OS X)

Ubuntu 18 
node -v
v10.16.0

3) Sample source code or steps to reproduce

let fullSchema = deref(self.baseSchema);
console.log('fullSchema', fullSchema);

(Write description of your issue here, stack traces from errors and code that reproduces the issue are helpful) The result is:

formdata_to_json         | fullSchema { '$schema': 'http://json-schema.org/draft-07/schema#',
formdata_to_json         |   '$id': 'http://localhost:3000/schemas/jobad.schema.json',
formdata_to_json         |   type: 'object',
formdata_to_json         |   title: 'The JobAd Schema',
...
formdata_to_json         |      ReferenceNumber:
formdata_to_json         |       { '$id': '#/properties/ReferenceNumber',
formdata_to_json         |         '$comment': 'Maybe change it to number?',
formdata_to_json         |         type: 'string',
formdata_to_json         |         title: 'The Referencenumber Schema',
formdata_to_json         |         maxLength: 30,
formdata_to_json         |         examples: [Array] },
formdata_to_json         |      Publisher:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/publisher.schema.json' },
formdata_to_json         |      CareerStatus:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/career-status.schema.json' },
formdata_to_json         |      LineOfBusiness:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/line-of-business.schema.json' },
formdata_to_json         |      OperatingArea:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/operating-area.schema.json' },
formdata_to_json         |      Schedule:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/schedule.schema.json' },
formdata_to_json         |      Locations:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/locations.schema.json' },
formdata_to_json         |      Remuneration:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/remuneration.schema.json' },
formdata_to_json         |      FormattedDescription:
formdata_to_json         |       { '$ref':
formdata_to_json         |          'http://localhost:3000/schemas/formatted-descriptions.schema.json' },
formdata_to_json         |      Professions:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/professions.schema.json' },
formdata_to_json         |      Deployment:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/deployments.schema.json' },
formdata_to_json         |      EmploymentLimitation:
formdata_to_json         |       { '$ref':
formdata_to_json         |          'http://localhost:3000/schemas/employment-limitation.schema.json' },
formdata_to_json         |      AdditionalCompensation:
formdata_to_json         |       { '$ref':
formdata_to_json         |          'http://localhost:3000/schemas/additional-compensation.schema.json' },
formdata_to_json         |      ContractType:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/contract-type.schema.json' },
formdata_to_json         |      WillingnessToTravel:
formdata_to_json         |       { '$ref':
formdata_to_json         |          'http://localhost:3000/schemas/willingness-to-travel.schema.json' },
formdata_to_json         |      Tags: { '$ref': 'http://localhost:3000/schemas/tags.schema.json' },
formdata_to_json         |      Meta: { '$ref': 'http://localhost:3000/schemas/meta.schema.json' },
formdata_to_json         |      UserArea:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/jobad-userarea.schema.json' },
formdata_to_json         |      RequiredEducation:
formdata_to_json         |       { '$ref':
formdata_to_json         |          'http://localhost:3000/schemas/required-education.schema.json' },
formdata_to_json         |      ProfessionalExperience:
formdata_to_json         |       { '$ref':
formdata_to_json         |          'http://localhost:3000/schemas/professional-experience.schema.json' },
formdata_to_json         |      Skills:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/skills.schema.json' },
formdata_to_json         |      Languages:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/languages.schema.json' },
formdata_to_json         |      Licenses:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/licenses.schema.json' },
formdata_to_json         |      DrivingLicences:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/driving-licences.schema.json' },
formdata_to_json         |      SoftSkills:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/soft-skills.schema.json' },
formdata_to_json         |      ManagerialResponsibility:
formdata_to_json         |       { '$ref':
formdata_to_json         |          'http://localhost:3000/schemas/managerial-responsibility.schema.json' },
formdata_to_json         |      Contact:
formdata_to_json         |       { '$ref': 'http://localhost:3000/schemas/contact.schema.json' } },
formdata_to_json         |   dependencies:
...
formdata_to_json         |         properties: [Object] } } }

As you see, all of the references with URL are skipped

jcurtis commented 5 years ago

This package doesn't support resolving web references. You'll need to use the synchronous version. Please see the documentation there: https://github.com/cvent/json-schema-deref

akimkelar commented 5 years ago

If so, remove please from description information that this package resolves references over the internet, because it does not.

bojand commented 5 years ago

It already states clearly so?

Basically a lighter, synchronous version of json-schema-deref but omits web references.

akimkelar commented 5 years ago

No, I still can see examples with external references in readme that won't work.

jcurtis commented 5 years ago

Fixed