Skip to content

Commit 3b61324

Browse files
committed
Add test showing the bug
1 parent 9432aaf commit 3b61324

19 files changed

Lines changed: 532 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
generatorName: ocaml
2+
outputDir: samples/client/petstore/ocaml-enum-in-composed-schema
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/ocaml/enum-in-composed-schema.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/ocaml
5+
additionalProperties:
6+
packageName: petstore_client
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
openapi: 3.0.0
2+
info:
3+
title: Test Enum in Composed Schema
4+
version: 1.0.0
5+
paths:
6+
/test:
7+
get:
8+
operationId: getTest
9+
responses:
10+
'200':
11+
description: Success
12+
content:
13+
application/json:
14+
schema:
15+
$ref: '#/components/schemas/TestModel'
16+
components:
17+
schemas:
18+
TestModel:
19+
type: object
20+
properties:
21+
name:
22+
type: string
23+
config:
24+
anyOf:
25+
- allOf:
26+
- type: object
27+
properties:
28+
type:
29+
type: string
30+
enum:
31+
- type1
32+
- type2
33+
- type3
34+
options:
35+
type: object
36+
properties:
37+
value:
38+
type: string
39+
enum:
40+
- value1
41+
- value2
42+
- value3
43+
optionalUrl:
44+
anyOf:
45+
- type: string
46+
format: uri
47+
- type: string
48+
enum:
49+
- ""
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=0.27.0
2+
ocaml-version=4.14.0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.ocamlformat
2+
README.md
3+
dune
4+
dune-project
5+
petstore_client.opam
6+
src/apis/default_api.ml
7+
src/apis/default_api.mli
8+
src/models/test_model.ml
9+
src/models/test_model_config.ml
10+
src/models/test_model_config_all_of_options.ml
11+
src/models/test_model_optional_url.ml
12+
src/support/enums.ml
13+
src/support/jsonSupport.ml
14+
src/support/request.ml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.21.0-SNAPSHOT
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
3+
4+
This OCaml package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
5+
6+
- API version: 1.0.0
7+
- Package version: 1.0.0
8+
- Generator version: 7.21.0-SNAPSHOT
9+
- Build package: org.openapitools.codegen.languages.OCamlClientCodegen
10+
11+
## Requirements.
12+
13+
OCaml 5.x
14+
15+
## Installation
16+
17+
Please run the following commands to build the package `petstore_client`:
18+
19+
```sh
20+
opam install . --deps-only --with-test
21+
eval $(opam env)
22+
dune build
23+
```
24+
25+
## Getting Started
26+
27+
The generated directory structure is:
28+
- `src/apis`: contains several modules, each with several functions. Each function is an API endpoint.
29+
- `src/models`: contains several modules. Each module contains:
30+
- a type `t` representing an input and/or output schema of the OpenAPI spec
31+
- a smart constructor `create` for this type
32+
- `src/support`: various modules used by the generated APIs and Models
33+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(include_subdirs unqualified)
2+
(library
3+
(name petstore_client)
4+
(public_name petstore_client)
5+
(flags (:standard -w -27))
6+
(libraries str cohttp-lwt-unix lwt yojson ppx_deriving_yojson.runtime)
7+
(preprocess (pps ppx_deriving_yojson ppx_deriving.std))
8+
(wrapped true)
9+
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(lang dune 2.0)
2+
(name petstore_client)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
opam-version: "2.0"
2+
name: "petstore_client"
3+
version: "1.0.0"
4+
synopsis: ""
5+
description: """
6+
Longer description
7+
"""
8+
maintainer: "Name <email>"
9+
authors: "Name <email>"
10+
license: ""
11+
homepage: ""
12+
bug-reports: ""
13+
dev-repo: ""
14+
depends: [
15+
"ocaml"
16+
"ocamlfind"
17+
"ocamlformat" {= "0.27.0"}
18+
"dune"
19+
"ppx_deriving_yojson"
20+
"conf-libev"
21+
"lwt"
22+
"cohttp-lwt-unix" {< "6.0.0"}
23+
"cohttp-async" {< "6.0.0"}
24+
]
25+
build: ["dune" "build" "-p" name]

0 commit comments

Comments
 (0)