Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions cli/example/openapi-generator-bugs/10398.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Bug 10398
servers:
- url: https://swapi.dev/api/
paths:
/planets:
get:
tags:
- swapi
operationId: getPlanets
responses:
"200":
description: List of planets
content:
application/json:
schema:
$ref: "#/components/schemas/PlanetList"
/planets/{planetId}:
get:
tags:
- swapi
operationId: getPlanet
parameters:
- name: planetId
in: path
description: Planet ID
required: true
schema:
type: integer
responses:
"200":
description: Planet name
content:
application/json:
schema:
$ref: "#/components/schemas/Planet"
components:
schemas:
Planet:
type: string
description: Planet name
PlanetList:
type: array
description: List of planets
items:
$ref: "#/components/schemas/Planet"
88 changes: 88 additions & 0 deletions cli/example/openapi-generator-bugs/16104.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"components": {
"schemas": {
"Example": {
"discriminator": {
"mapping": {
"generic": "ExampleGeneric",
"images": "ExampleImages"
},
"propertyName": "tag"
},
"oneOf": [
{
"$ref": "#/components/schemas/ExampleGeneric"
},
{
"$ref": "#/components/schemas/ExampleImages"
}
]
},
"ExampleGeneric": {
"properties": {
"content": {
"type": "string"
},
"tag": {
"enum": [
"generic"
],
"type": "string"
}
},
"required": [
"content",
"tag"
],
"type": "object"
},
"ExampleImages": {
"properties": {
"images": {
"items": {
"type": "string"
},
"type": "array"
},
"tag": {
"enum": [
"images"
],
"type": "string"
}
},
"required": [
"images",
"tag"
],
"type": "object"
}
}
},
"info": {
"title": "Bug 16104",
"version": ""
},
"openapi": "3.0.0",
"paths": {
"/example": {
"get": {
"responses": {
"200": {
"content": {
"application/json;charset=utf-8": {
"schema": {
"items": {
"$ref": "#/components/schemas/Example"
},
"type": "array"
}
}
},
"description": ""
}
}
}
}
}
}
28 changes: 28 additions & 0 deletions cli/example/openapi-generator-bugs/22119.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"openapi" : "3.0.1",
"info" : {
"title" : "Bug 22119",
"version" : "v0"
},
"servers" : [ {
"url" : "http://127.0.0.1:4000",
"description" : "Generated server url"
} ],
"paths": {},
"components" : {
"schemas" : {
"TestObject" : {
"type" : "object",
"properties" : {
"body" : {
"type" : "array",
"items": {
"type" : "string",
"enum" : [ "ENUM_FIRST", "ENUM_SECOND", "ENUM_THIRD" ]
}
}
}
}
}
}
}
43 changes: 43 additions & 0 deletions cli/example/openapi-generator-bugs/22530.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"openapi": "3.0.1",
"info": {
"title": "Bug 22530",
"version": "v0"
},
"servers": [
{
"url": "http://127.0.0.1:3000",
"description": "Generated server url"
}
],
"paths": {
"/api/something": {
"get": {
"operationId": "something-controller_get",
"parameters": [],
"responses": {
"200": {
"content": {
"*/*": {
"schema": {
"type": "array",
"items": {
"type": "string",
"enum": [
"SOMETHING",
"SOMETHING_ELSE",
"SOMETHING_MORE"
]
}
}
}
},
"description": "OK"
}
},
"tags": ["something-controller"]
}
}
},
"components": {}
}
30 changes: 30 additions & 0 deletions cli/example/openapi-generator-bugs/7889.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
openapi: 3.0.0
info:
version: 0.1.0-beta
title: Bug 7889

paths:
/articles:
get:
summary: Get articles
operationId: GetArticles
parameters:
- name: category
in: query
description: Comma separated list of categories to filter
required: false
schema:
# NOTE elm code generation for array type query params is buggy as of now.
type: array
items:
$ref: "#/components/schemas/articleCategory"
responses:
"200":
description: Articles
components:
schemas:
articleCategory:
type: string
enum:
- Travel
- Business
9 changes: 9 additions & 0 deletions cli/src/TestGenScript.elm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ run =
telegramBot =
OpenApi.Config.inputFrom (OpenApi.Config.File "./example/telegram-bot.json")

bug : Int -> OpenApi.Config.Input
bug n =
OpenApi.Config.inputFrom (OpenApi.Config.File ("./example/openapi-generator-bugs/" ++ String.fromInt n ++ ".yaml"))

profileConfig : OpenApi.Config.Config
profileConfig =
-- Slimmed config for profiling
Expand All @@ -125,6 +129,11 @@ run =
|> OpenApi.Config.withInput binaryResponse
|> OpenApi.Config.withInput nullableEnum
|> OpenApi.Config.withInput cookieAuth
|> OpenApi.Config.withInput (bug 7889)
|> OpenApi.Config.withInput (bug 10398)
|> OpenApi.Config.withInput (bug 16104)
|> OpenApi.Config.withInput (bug 22119)
|> OpenApi.Config.withInput (bug 22530)
Comment on lines +132 to +136
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this!


config : OpenApi.Config.Config
config =
Expand Down