Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

is allOf supported? #24

Open
ghost opened this issue Sep 17, 2016 · 5 comments
Open

is allOf supported? #24

ghost opened this issue Sep 17, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Sep 17, 2016

my swagger.yml contains:

definitions:
  User:
    type: "object"
    required:
      - "email"
      - "uid"
      - "password"
      - "username"
    properties:
      uid:
        type: "string"
        description: "Usually a UUID"
        example: "234"
#        readOnly: true
      email:
        type: "string"
        example: "[email protected]"
      password:
        type: "string"
        example: "3X8(ISU!!"
      username:
        type: "string"
        example: "yoshi"
        minLength: 1
  ExtendedErrorModel:
    allOf:
    - $ref: "#/definitions/User"
    - type: "object"
      required:
        - "rootCause"
      properties:
        rootCause:
          type: "string"

and it chokes on

self = <swagger_parser.swagger_parser.SwaggerParser object at 0x110a8f590>
prop_spec = {'allOf': [{'$ref': '#/definitions/User', 'x-scope': ['']}, {'properties': {'rootCause': {'type': 'string'}}, 'required': ['rootCause'], 'type': 'object'}]}

    def _example_from_complex_def(self, prop_spec):
        """Get an example from a property specification.

            In case there is no "type" key in the root of the dictionary.

            Args:
                prop_spec: property specification you want an example of.

            Returns:
                An example.
            """
        if 'schema' in prop_spec and 'type' not in prop_spec['schema']:
            definition_name = self.get_definition_name_from_ref(prop_spec['schema']['$ref'])
            if self.build_one_definition_example(definition_name):
                return self.definitions_example[definition_name]
>       elif prop_spec['schema']['type'] == 'array':  # Array with definition
E       KeyError: 'schema'

example comes from here

@cyprieng
Copy link
Owner

It's not supported yet, but thanks for the report. If you want to provide a PR it would be good.

@ghost
Copy link
Author

ghost commented Sep 17, 2016

additionalProperties is also not supported

    additionalProperties:
      $ref: "#/definitions/Yoshi"

@flavianh
Copy link

@pouledodue Feel free to submit a PR, we'll gladly have a look at it :)

@jwg4
Copy link

jwg4 commented Jun 26, 2018

@flavianh It looks like there is already a PR waiting for approval here: #61
Is this PR likely to be merged? Is there anything I can do to help?

@jwg4
Copy link

jwg4 commented Jul 3, 2018

PR #61 was merged so this issue may be solved.

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

3 participants