I'm writing a custom codegen and in my language a model can be itself an 
array with properties. 

After trying different things I came up with this yaml:

    swagger: '2.0'
    info:
      title: "Open Api"
      version: "20161229163355"
    host: localhost
    schemes:
      - http
    basePath: /OpenApi.NetEnvironment/rest
    produces:
      - application/json
    paths:
      /Prueba:
        post:
          tags:
            - Prueba
          operationId: "Prueba"
          summary: "Prueba"
          parameters:
            - name: "Prueba_Input"
              in: "body"
              required: false
              schema:
                $ref: "#/definitions/SDT2"
    
    
          responses:
            200:
              description: "Successful operation"
              schema:
                $ref: "#/definitions/SDT3"
            404:
              description: "Not found"
    definitions:
      SDT2:
        discriminator: level
    
        type: array
        items:
          properties:
            Id:
              description: Id
              type: "integer"
              format: "int32"
      
            Prueba:
              description: Prueba
              type: array
              items:
                type: "integer"
                format: "int32"
    
      SDT2.Level1:
        allOf:
          - $ref: "#/definitions/SDT2"
          - type: object
            properties:
              sdt:
                description: sdt
                type: "integer"
                format: "int32"
    
      SDT3:
        discriminator: level
    
        type: array
        items:
          properties:
            Id:
              description: Id
              type: "integer"
              format: "int32"
      
            Prueba:
              description: Prueba
              type: array
              items:
                type: "integer"
                format: "int32"
                
      SDT3.Level1:
        allOf:
          - $ref: "#/definitions/SDT3"
          - type: object
            properties:
              sdt:
                description: sdt
                type: "integer"
                format: "int32"

This generates, for instance in Java, a model for each definition and an 
extra model SDT2Inner which is marked as hasEnums. Both of the models 
marked as arrays (SDT2, SDT3) have this inner model as parent. Here is the 
json <https://s3.amazonaws.com/genexuss3test/openAPI/oneInner.json>.

I would like to know where is this inner model generated?

I have noticed that if I change the properties from SDT3 so that they are 
different to the ones from SDT2 I get 2 inner models: SDT2Inner and 
SDT3Inner. If possible I would like that to be the behaviour of codegen, 
maybe there is something I can overwrite from my class to achieve this. Here 
is the json I get in this case 
<https://s3.amazonaws.com/genexuss3test/openAPI/twoInner.json>.

*Is there any other way in which, without having extra models, I can get a 
model to be marked as hasEnums and at the same time have properties? THIS 
IS MY MAIN GOAL*

To generate the jsons I attached I'm using this command:

    java -DdebugModels -jar modules/swagger-codegen-cli/target/swagger-
codegen-cli.jar generate -i  C:\default.yaml -l java

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to