Skip to content
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

support of the allOf inside array(items) #1883

Closed
PavelPolyakov opened this issue Jan 19, 2016 · 19 comments
Closed

support of the allOf inside array(items) #1883

PavelPolyakov opened this issue Jan 19, 2016 · 19 comments

Comments

@PavelPolyakov
Copy link

Hi,

Couple of examples.

This one is basic, and it works:

  responses:
    200:
      schema:
        type: array
        items:
          type: object
          properties:
            a:
              type: string
            b:
              type: string

image

Here is the one with allOf, but not inside items:

  responses:
    200:
      schema:
        allOf:
          - $ref: ../../definitions/structures/industry.yaml
          - properties:
              id:
                type: integer
                format: int64

Works:
image

And here is the one using allOf and array as response structure:

  responses:
    200:
      schema:
        type: array
        items:
          allOf:
            - $ref: ../../definitions/structures/industry.yaml
            - properties:
              id:
                type: integer
                format: int64

Which results to this:
image

Does not work.

It this an issue?

Regards,

@webron
Copy link
Contributor

webron commented Jan 19, 2016

Looks like.

@vellotis
Copy link

+1

1 similar comment
@jpautom
Copy link

jpautom commented Apr 29, 2016

+1

@orbit-dna
Copy link

orbit-dna commented Jul 4, 2016

+1
a simple example here:

swagger: '2.0'
info:
  title: API
  version: "1.0.0"
basePath: /api
paths:
  /path:
    get:
      responses:
        200:
          schema:
            type: array
            items:
              type: object
              allOf:
                - properties:
                    id:
                      type: integer
        default:
          schema:
            type: string

the result in swagger-ui:

[
  {}
]

However, this works:

swagger: '2.0'
info:
  title: API
  version: "1.0.0"
basePath: /api
paths:
  /path:
    get:
      responses:
        200:
          schema:
            type: object          # differ here
            properties:           # differ here
              array:              # differ here
                type: array
                items:
                  type: object
                  allOf:
                    - properties:
                        id:
                          type: integer
        default:
          schema:
            type: string

Seems only fail when the array dirrectly under schema

@lmanco
Copy link

lmanco commented Nov 9, 2016

+1

1 similar comment
@dnascimento
Copy link

+1

@iericzhu
Copy link

iericzhu commented Jan 5, 2017

+1

1 similar comment
@leonliem
Copy link

leonliem commented Jan 6, 2017

+1

@gnozell
Copy link

gnozell commented Jan 10, 2017

I'm getting the same error

From this json

    "swagger": "2.0",
    "info": {
        "version": "0.0.0",
        "title": "Simple API"
    },
    "responses": {
        "200": {
            "description": "test",
            "schema": {
                "allOf": [
                    {
                        "type": "object",
                        "properties": {
                            "description": {
                                "type": "string"
                            }
                        }
                    }
                ]
            }
        },
        "201": {
            "description": "test",
            "schema": {
                "type": "object",
                "properties": {
                    "description": {
                        "type": "string"
                    }
                }
            }
        }
    },
    "paths": {
        "/works": {
            "get": {
                "responses": {
                    "200": {
                        "description": "test",
                        "schema": {
                            "type": "object",
                            "properties": {
                                "description": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/works_with_refs": {
            "get": {
                "responses": {
                    "200": {
                        "$ref": "#/responses/201"
                    }
                }
            }
        },
        "/works_with_allOf": {
            "get": {
                "responses": {
                    "200": {
                        "description": "test",
                        "schema": {
                            "allOf": [
                                {
                                    "properties": {
                                        "description": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/doesnt_work_refs_and_refs": {
            "get": {
                "responses": {
                    "200": {
                        "$ref": "#/responses/200"
                    }
                }
            }
        }
    }

I notice this has been open for a year is there any progress as to what might be causing the issue or were to begin looking?

@webron
Copy link
Contributor

webron commented Jan 10, 2017

We're working on a major update to the project that should resolve this issue and others. Before you ask, I'm afraid I don't have an ETA.

@IanGallacher
Copy link

Any updates on the ETA?

@webron
Copy link
Contributor

webron commented Feb 7, 2017

A few weeks.

@jonathanhuet
Copy link

+1

@JLLeitschuh
Copy link

I could potentially dive in and try to fix this problem if someone could give me some direction on where to start.

@webron
Copy link
Contributor

webron commented Mar 3, 2017

Honestly, I wouldn't bother. We're very close to releasing a new major version of swagger-ui (just a few weeks away) and I know this issue doesn't exist in it.

@JLLeitschuh
Copy link

Oh, awesome.
What branch is this on? We would love to pull that code in and run it on our (internal company) servers if it's been fixed.

@webron
Copy link
Contributor

webron commented Mar 3, 2017

It's not public yet.

@jonathanhuet
Copy link

Working! Thanks!!

PD: What a huge update (clap)

@webron
Copy link
Contributor

webron commented Mar 24, 2017

This is supported and working in 3.0.

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