Simple Discrimination
I am using `editor.swagger.io` to generate a java client. In that client, I am directly using the `JSON` class to deserialize a very simple JSON string, and to see what Swagger does. The challenge I am giving Swagger is simple discrimination. Here is my Swagger YAML. (Note this may not be a useful Swagger schema. It is just for experimentation)
swagger: "2.0"
info:
  title: "Minimal Example"
  version: "0.0.1"
tags: []
paths: {}
definitions:
  Decorator:
    type: object
    required:
      - type
    properties:
      type:
        type: string
  OinkDecorator:
    allOf:
      - $ref: '#/definitions/Decorator'
      - type: object
        required:
          - oink
        properties:
          oink:
            type: string
  FooDecorator:
    allOf:
      - $ref: '#/definitions/Decorator'
      - type: object
        required:
          - foo
        properties:
          foo:
            type: string
  FieldModel:
    type: object
    properties:
      decorators:
        type: array
        items:
          $ref: '#/definitions/OinkDecorator'
And the JSON I am trying to deserialize:
{ "type" : "asdasd", "decorators" : [{ "type":"asqqweqwe", "oink": "adfasdf"}] }
More info: So, I am trying to deserialize this JSON as a FieldModel. If I were to change the Swagger schema to NOT have two possible child fields (Oink and Foo), the deserialization happens as expected (e.g. I get a FieldModel which contains and Oink. However, as it appears above (even with a discriminator), what I can't seem to avoid is getting a FieldModel with a simple Map representation of the child.
Does discrimination work in deserialization? Am I not employing it correctly? Any ideas are appreciated. Please and thank you.
Hi mcostantini there are issues on codegen related to your unexpected behavior, right now schemas listed on `oneOf`, `anyOf`, `allOf` are not being handled property. I'll be working on this issue and keep you updated about that.