Skip to content

Subs of "allOf" definitiions get all properties of the ensemble #1400

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
gaaf opened this issue Jun 22, 2015 · 6 comments
Closed

Subs of "allOf" definitiions get all properties of the ensemble #1400

gaaf opened this issue Jun 22, 2015 · 6 comments

Comments

@gaaf
Copy link

gaaf commented Jun 22, 2015

When defining a "allOf" definition, a part which is referenced gets all the properties the ensemble gets. It should keep only its own properties.

In the example below, the "Param" definition incorrectly gets the "param2" property from the "ParamExtended" definition in the ui. It should only have the "test" property.

This is on 2.1.0+ @d75505fb73a6ac4ecbeabc47bd5a42b0f4d3f270

{
    "swagger": "2.0",
    "basePath": "/", 
    "schemes": [
        "https"
    ],
    "info": {
        "version": "2.1.0",
        "title": "allOf bug demo"
    },
    "paths": {
        "/allof": {
            "post": {
                "parameters": [
                    {
                        "name": "param",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/Param"
                        }
                    }
                ],
                "responses": {
                    "default": {
                        "description": "Return"
                    }
                }
            }
        }
    },
    "definitions": {
        "Param": {
            "type": "object",
            "properties": {
                "test": {
                    "type": "string"
                }
            }
        },
        "ParamExtended": {
            "allOf": [
                { "$ref": "#/definitions/Param" },
                {
                    "type": "object",
                    "properties": {
                        "param2": {
                            "type": "string"
                        }
                    }
                }
            ]
        }
    }
}
@webron webron added this to the v2.1.1 milestone Jun 22, 2015
@jharmn
Copy link

jharmn commented Jun 22, 2015

Looks like this is the UI aspect of implementing allOf in swagger-js: swagger-api/swagger-js#456

@webron
Copy link
Contributor

webron commented Jun 22, 2015

@jasonh-n-austin - yeah, this issue and #1399 should both be controlled by swagger-js.

@jharmn
Copy link

jharmn commented Jun 22, 2015

Specifically, in the 'limitations' of swagger-js#456, "The rendering support is not complete. The objects will contain the necessary reference information, but the json sample & mock signatures are not added". I'm assuming this is the rendering support, but the question is, should this be a bug in swagger-js instead?

@webron
Copy link
Contributor

webron commented Jun 22, 2015

Right, the support is not complete doesn't mean that's what's supported should work properly ;) and indeed it is a bug. Should have a respective bug in js as well, yes.

@jharmn
Copy link

jharmn commented Jun 22, 2015

Digging into issues a bit deeper, it seems like this might be caught up in moving rendering out of swagger-js and into swagger-ui: #1248.
@fehguy amirite ❓

@webron
Copy link
Contributor

webron commented Mar 20, 2017

This is no longer an issue in 3.0.

@webron webron closed this as completed Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants