nytimes / openapi2proto

A tool for generating Protobuf v3 schemas and gRPC service definitions from OpenAPI specifications
Apache License 2.0
961 stars 98 forks source link

Array as additionalPrperties #94

Closed loudent2 closed 5 years ago

loudent2 commented 5 years ago

Hey All,

My team at Autodesk is looking to use this but we ran into a bug when using arrays as addtionalProperties e.g.

definitions:
  testResponse:
    type: object
    properties:
      testThings:
        type: array
        description: 'list of things'
        items:
          $ref: '#/definitions/TestThings'
      mappedTestThings:
        type: object
        description: 'map of testThingStuff'
        additionalProperties:
          type: array
          description: list of test thing Stuff
          items:
            $ref: '#/definitions/TestThingStuff'

I forked the code and I have what I think is a fix ready. Are you interested in having my changes merged?

cheers, Troy Louden Autodesk Cloud Licensing Services

jprobinson commented 5 years ago

Howdy @loudent2!

There's currently a PR that popped up today attempting to add this functionality: #93

The PR is looking for some feedback on how this expects to be mirrored in the Protobuf world, so please take a look and see if the implementation matches your needs. At this point in time, repeated fields are not allowed as values in a Protobuf map so some kind of wrapper may be required, which may not really give the effect you want.

jprobinson commented 5 years ago

93 has been merged