cybertk / csonschema

CSON Schema is a little language that compiles into JSON Schema
MIT License
8 stars 0 forks source link

If $raw is used the other settings will be discarded #14

Open mloureiro opened 8 years ago

mloureiro commented 8 years ago

Hi

I was attempting to do something as:

errors:
  global: 'string'
  $raw:
    additionalProperties: true

But it compiled to:

{
    "type": "object",
    "properties": {
        "message": {
            "type": "string"
        },
        "errors": {
            "additionalProperties": true
        }
    },
    "required": [
        "message",
        "errors"
    ],
    "additionalProperties": false,
    "$schema": "http://json-schema.org/draft-04/schema"
}

If you notice there is no reference to the global property.


It's possible to make it work through the properties in the raw part, like:

errors:
  $raw:
    properties:
        global: 'string'
    additionalProperties: true

But it would be a nice to have feature

😃

cybertk commented 8 years ago

Thanks for your suggestion, you are welcome to send a PR if possible.

mloureiro commented 8 years ago

I'll take a look at the code and see how it goes :)