Skip to content

[BUG] Golang - When using import mappings, import mapping is not properly generated when using composition plus slice pointer type #2008

Description

@chaslain

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
  1. create two specs, one referencing the other
  2. Reference a slice type from 1 to another
  3. optional reference a non slice type to see desired behavior
  4. write configuration file to point import mapping of spec 2 to spec 1's output generation
  5. Run the generator
Suggest a fix

Use same external mapping logic when type is a slice pointer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions