sylvainlaurent / swagger-validator-maven-plugin

A maven plugin that validates swagger files in yaml and json formats
Apache License 2.0
11 stars 6 forks source link

Fixing NPE during ComposedModel validation in InheritanceChainPropertiesValidator #16

Closed oyeli closed 5 years ago

oyeli commented 5 years ago

I had faced with NPE during validation Foo1 definition with InheritanceChainPropertiesValidator. composedModelWrapper.getChild().getProperties() throws NPE because composedModelWrapper.getChild() is null for Foo2 model

Model definitions to show inheritance hierarchy :

  Foo1:
    x-discriminator-value: value1
    allOf:
    - $ref: '#/definitions/Foo2'

  Foo2:
    allOf:
    - $ref: '#/definitions/Foo3'

  Foo3:
    allOf:
    - $ref: '#/definitions/Foo4'
    - type: object
      discriminator: prop1
      required:
      - prop1
      properties:
        prop1:
          $ref: '#/definitions/Foo3Type'

  Foo4:
    type: object
    properties:
      id:
        type: string

  Foo3Type:
    type: string
    enum:
    - value1
    - value2
    - value3
oyeli commented 5 years ago

I already have fix for this issue. I'm going to create PR.

giuliopulina commented 5 years ago

Hi @oyeli, could you please describe the use case to reproduce the error?

oyeli commented 5 years ago

Please, look at my PR https://github.com/sylvainlaurent/swagger-validator-maven-plugin/pull/17.

oyeli commented 5 years ago

Hi @oyeli, could you please describe the use case to reproduce the error?

Yes, sure. I'll update description.

kh0ma commented 5 years ago

Hi @giuliopulina.

Today we also faced this issue after updating our normalizer library. It is highly recommended to fix it. Thanks.

sylvainlaurent commented 5 years ago

fixed by PR #17

oyeli commented 5 years ago

@sylvainlaurent could you please put the new version of the plugin to mvnrepository.com

sylvainlaurent commented 5 years ago

I deployed a 1.2.5 to maven central