Skip to content

unhandled type to resolve JSON pointer #2768

@kishvanchee

Description

@kishvanchee

Problem statement

I am trying to generate the server and models but I keep getting the following error

preprocessing spec with option:  minimal flattening
at #/definitions/dimension_structure/properties/group/items, unhandled type to resolve JSON pointer #definitions/attribute_group. Expected a Schema, got: *spec.Swagger

Swagger specification

consumes:
- application/api.schema.v1.json
info:
  description: This is a metadata API
  title: Schema API
  version: 1.0.0
produces:
- application/api.schema.v1.json
schemes:
- http
swagger: "2.0"
paths:
  /:
    get:
      tags:
        - schema_api
      parameters:
        - name: customer
          in: query
          type: string
        - name: entity
          in: query
          type: string
        - name: product
          in: query
          type: string
          default: "hk"
      responses:
        200:
          description: Entity details
          schema:
            type: array
            items:
              $ref: "#/definitions/dimension_structure"
        default:
          description: generic error response
          schema:
            $ref: "#/definitions/error"
definitions:
  attribute_details:
    type: object
    properties:
      value:
        type: string
      label:
        type: string
      description:
        type: string
      type:
        type: string
  attribute_group:
    type: object
    required:
      - dimensions
    properties:
      value:
        type: string
      dimensions:
        type: array
        items:
          $ref: "#/definitions/attribute_details"
  dimension_structure:
    type: object
    required:
      - group
    properties:
      entity:
        type: string
      group:
        type: array
        items:
          $ref: "#definitions/attribute_group"
  error:
    type: object
    required:
      - message
    properties:
      code:
        type: integer
        format: int64
      message:
        type: string

Expectation

type AttributeDetails struct {
        Value       string `json:"value"`
        Label       string `json:"label"`
        Description string `json:"description"`
        Type        string `json:"type"`
}

type AttributeGroup struct {
        Value      string      `json:"value"`
        dimensions []AttributeDetails `json:"dimensions"`
}

type Entity struct {
        Entity string  `json:"entity"`
        Group  []AttributeGroup `json:"group"`
}

JSON Schema

[
  {
    "entity": "string",
    "group": [
      {
        "value": "string",
        "dimensions": [
          {
            "value": "string",
            "label": "string",
            "description": "string",
            "type": "string"
          }
        ]
      }
    ]
  }
]

Environment

swagger version:
version: v0.29.0
commit: 53696ca

go version: go1.18.1 linux/amd64

OS: Arch Linux

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