Skip to content

how to use swag example tag for array samples #2107

@Z3NTL3

Description

@Z3NTL3

so

type Example struct {
      Images     [][]byte      `json:"image,omitempty" bson:"image,omitempty" validate:"omitempty,base64" swaggertype:"string" format:"base64" example:"["b64 encoded image","b64 encoded image"]"`
}

Annotation

example:"["b64 encoded image","b64 encoded image"]"`

How would I annotate an array example? I tried the same as with Swagger Array Examples docs but it did not work unfortunately:

components:
  schemas:
    ArrayOfInt:
      type: array
      items:
        type: integer
        format: int64
+       example: [1, 2, 3]

and ye my struct is [][]byte but i am handling the base64 encoded image string to unmarshal it back into array of binary images when a request is send to backend before unmarshalling

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