oapi-codegen
oapi-codegen copied to clipboard
[BUG] Golang - When using import mappings, import mapping is not properly generated when using composition plus slice pointer type
one.yaml
schemas:
Thing:
type: object
properties:
Property: value
Example:
properties:
Thing
type: array
items: $ref "#/components/schemas/Thing"
two.yaml
schemas:
MyThing:
allOf:
- $ref: "one.yaml#/components/schemas/Example'
- type: object
properties: # whatever one might add here...
Output when generating two.yaml:
type MyThing struct {
Thing *[]Thing
}
Expected output generating two.yaml:
type MyThing struct {
Thing *[]externalRef0.Thing
}
Steps to reproduce
- create two specs, one referencing the other
- Reference a slice type from 1 to another
- optional reference a non slice type to see desired behavior
- write configuration file to point import mapping of spec 2 to spec 1's output generation
- Run the generator
Suggest a fix
Use same external mapping logic when type is a slice pointer.
This issue does not appear in master - is it time for another release?
Cannot access master without forking.
Are you sure this doesn't happen in master? I tried it with the master build, but it isn't working for me.