Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Feature/expandable schemas #176

Merged
merged 1 commit into from
Apr 27, 2016
Merged

Feature/expandable schemas #176

merged 1 commit into from
Apr 27, 2016

Conversation

alvassin
Copy link
Contributor

@alvassin alvassin commented Apr 20, 2016

Added flag dereferenceSchemas, that allows to preprocess json-schemas and provide resolved $refs. Fixes #140

return true

if fileInfo.parentNode
schemasSeqNode = loader.findSchemasSequenceNode(node)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you have this RAML:

#%RAML 0.8
/foo:
  post:
    body:
      schema: !include someFastFile.json
schemas: !include someSlowFile.yaml

You should defer all schema reading and processing, until all !included files have been loaded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmartinezg got it. thanks!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a sample test, with random response times for includes:

https://github.com/raml-org/raml-js-parser/blob/master/test/specs/regressions.js#L960

@alvassin alvassin changed the title Feature/expandable schemas WIP: Feature/expandable schemas Apr 20, 2016
@alvassin
Copy link
Contributor Author

@dmartinezg I implemented support for all !include-d schemas, they work correctly now.

As for inline-specified schemes, that have $refs (see below), I need this issue to be fixed.

After i will get some response from maintainers i will add support for such schemas too.

... raml definition ...
responses:
  200:
    body:
      application/json:
        schema: |
          {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "object",
            "properties": {
              "items": {
                "$ref": "./schemas/collections/items.json"
              }
            }
          }

@alvassin alvassin changed the title WIP: Feature/expandable schemas Feature/expandable schemas Apr 22, 2016
@alvassin
Copy link
Contributor Author

@dmartinezg please check code & tests, all cases should be covered now.

@dmartinezg
Copy link

@alvassin, apologies for reviewing late, I've had a big mail backlog for the past few days.

I think it is ready to merge, have you signed this?: https://api-notebook.anypoint.mulesoft.com/notebooks#bc1cf75a0284268407e4

After you do that, I can merge, tag and deploy to npm

@alvassin
Copy link
Contributor Author

@dmartinezg you've got nice automation. Signed.

@dmartinezg
Copy link

Oh, please, squash commits

@alvassin
Copy link
Contributor Author

@dmartinezg done.

@dmartinezg dmartinezg merged commit b2121be into raml-org:master Apr 27, 2016
@dmartinezg
Copy link

@alvassin, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access schema include paths
2 participants