Skip to content

Support oneOf #1056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nickretallack opened this issue Mar 20, 2015 · 8 comments
Closed

Support oneOf #1056

nickretallack opened this issue Mar 20, 2015 · 8 comments

Comments

@nickretallack
Copy link

I used a oneOf and it rendered as an empty object. It seems to be ignored right now.

@webron
Copy link
Contributor

webron commented Mar 26, 2015

oneOf is not supported by the Swagger specification.

@webron webron closed this as completed Mar 26, 2015
@nickretallack
Copy link
Author

Not even in the part where it delegates to jsonschema?

@webron
Copy link
Contributor

webron commented Mar 27, 2015

Not anywhere. We don't delegate to JSON Schema. The spec is very specific about it. We use an extended subset of JSON Schema, and explicitly don't support oneOf.

@hansbeld
Copy link

Unfortunately no. It uses a subset of the draft-4.
You could adapt the swagger-client.js by adding an extra model type and resolve it accordingly.

@willshulman
Copy link

Just curious. Why was oneOf explicitly not supported?

@webron
Copy link
Contributor

webron commented Apr 24, 2015

@wir33658
Copy link

This way something like defining a tree structure is not possible ..... Really bad news (Thought Swagger is good, but - oh, well ....)

E.g.

    "ModelFolder": {
        "properties": {
            "id": {
                "type": "number",
                "format": "integer"
            },
            "parentId": {
                "type": "number",
                "format": "integer"
            },
            "name": {
                "type": "string"
            },
            "itemType": {
                "type": "string"
            },
            "children": {
                "type": "array",
                "items": {
                    "anyOf":[
                        { "$ref": "#/definitions/ModelFolder"  },
                        { "$ref": "#/definitions/Model" }
                    ]
                }
            }
        },
    "Model": {
        "properties": {
            "id": {
                "type": "number",
                "format": "integer"
            },
            "parentId": {
                "type": "number",
                "format": "integer"
            },
            "name": {
                "type": "string"
            },
            "itemType": {
                "type": "string"
            }
        }

is not possible ?!?!?!?

I don't get it (Please be more pragmatic. But maybe its technically simply not doable in the Swagger implementation).

@webron
Copy link
Contributor

webron commented May 22, 2015

It is doable, but please send your question to the google group. It has nothing to do with the UI.

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

No branches or pull requests

5 participants