Closed
Description
Description
Swagger-codegen fails to handle recursion after switching to structs.
Swagger-codegen version
2.4.0
Swagger declaration file content or url
swagger: "2.0"
info:
title: "Example"
version: "1.0.0"
host: "store.example.com"
basePath: "/v2"
schemes:
- "http"
paths:
/category/{categoryId}:
get:
summary: "Find category by ID"
operationId: "getCategoryById"
produces:
- "application/json"
parameters:
- name: "categoryId"
in: "path"
description: "ID of category to return"
required: true
type: "integer"
format: "int64"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Category"
400:
description: "Invalid ID supplied"
404:
description: "Category not found"
definitions:
Category:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
parent:
$ref: "#/definitions/Category"
children:
type: array
items:
$ref: "#/definitions/Category"
xml:
name: "Category"
Command line used for generation
-l swift4
Steps to reproduce
Generate client with swagger provided.
Add client to xcode project
Try to compile.
Related issues/PRs
Suggest a fix/enhancement
- https://stackoverflow.com/questions/36080491/swift-struct-type-recursion
- Fall back to classes in some situations
- Add option to use classes instead of struct (or just use class by default)
Metadata
Metadata
Assignees
Labels
No labels