Skip to content
This repository has been archived by the owner on Mar 15, 2019. It is now read-only.

swagger -> raml, null primitive type -> nil #38

Open
marbemac opened this issue Oct 14, 2016 · 2 comments
Open

swagger -> raml, null primitive type -> nil #38

marbemac opened this issue Oct 14, 2016 · 2 comments

Comments

@marbemac
Copy link
Contributor

According to the raml10 spec, nil is the allowed type. The JSON schema spec uses the null primitive type, so this is what swagger specs will use. Thus, we need to change null -> nil when parsing types/schemas for raml 10.

RAML10
https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md#built-in-types

I could not find the allowed primitive types for raml08, so I am not sure if null is allowed (or nil). Perhaps @sichvoge could shed some light on this? This is what I could find:
https://github.com/raml-org/raml-spec/blob/master/versions/raml-08/raml-08.md#type

To replicate, here is an example input swagger that will lead to a (invalid) null property in the raml10 export:

{
    "swagger": "2.0",
    "info": {
        "title": "Test",
    },
    "paths": {
        "/users": {
            "get": {
                "responses": {
                    "200": {
                        "description": "",
                        "schema": {
                            "type": "object",
                            "properties": {
                                "foo": {
                                    "type": "null"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
}
@marbemac
Copy link
Contributor Author

@glodieu could you take a look at this one when you have some time? Let me know if you have any questions!

@sichvoge
Copy link

If it is a pure JSON schema, RAML 0.8 does not care if you put in "null". So the following schema should be fine:

"type": "object",
"properties": {
  "foo": {
    "type": "null"
  }
}

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

No branches or pull requests

2 participants