mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-13 05:00:50 +00:00
Fix NPE with Haskell client generator with OAS3 spec (#334)
* fix NPE with haskell client oas3, better type check * better unknown type check
This commit is contained in:
parent
d99f46cff9
commit
e45b3784f1
@ -1233,7 +1233,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(schema.get$ref())) { // object
|
if (StringUtils.isNotBlank(schema.get$ref())) { // reference to another definition/schema
|
||||||
// get the schema/model name from $ref
|
// get the schema/model name from $ref
|
||||||
String schemaName = ModelUtils.getSimpleRef(schema.get$ref());
|
String schemaName = ModelUtils.getSimpleRef(schema.get$ref());
|
||||||
if (StringUtils.isNotEmpty(schemaName)) {
|
if (StringUtils.isNotEmpty(schemaName)) {
|
||||||
@ -1242,7 +1242,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
LOGGER.warn("Error obtaining the datatype from ref:" + schema.get$ref() + ". Default to 'object'");
|
LOGGER.warn("Error obtaining the datatype from ref:" + schema.get$ref() + ". Default to 'object'");
|
||||||
return "object";
|
return "object";
|
||||||
}
|
}
|
||||||
} else { // primitive type (non-model)
|
} else { // primitive type or model
|
||||||
return getAlias(getPrimitiveType(schema));
|
return getAlias(getPrimitiveType(schema));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1255,7 +1255,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @return type
|
* @return type
|
||||||
*/
|
*/
|
||||||
private static String getPrimitiveType(Schema schema) {
|
private static String getPrimitiveType(Schema schema) {
|
||||||
if (ModelUtils.isStringSchema(schema) && "number".equals(schema.getFormat())) {
|
if (schema == null) {
|
||||||
|
throw new RuntimeException("schema cannnot be null in getPrimitiveType");
|
||||||
|
} else if (ModelUtils.isStringSchema(schema) && "number".equals(schema.getFormat())) {
|
||||||
// special handle of type: string, format: number
|
// special handle of type: string, format: number
|
||||||
return "BigDecimal";
|
return "BigDecimal";
|
||||||
} else if (ModelUtils.isByteArraySchema(schema)) {
|
} else if (ModelUtils.isByteArraySchema(schema)) {
|
||||||
@ -1294,16 +1296,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return "UUID";
|
return "UUID";
|
||||||
} else if (ModelUtils.isStringSchema(schema)) {
|
} else if (ModelUtils.isStringSchema(schema)) {
|
||||||
return "string";
|
return "string";
|
||||||
} else {
|
} else if (schema.getProperties() != null && !schema.getProperties().isEmpty()) { // having property implies it's a model
|
||||||
if (schema != null) {
|
return "object";
|
||||||
// TODO the following check should be covered by ModelUtils.isMapSchema(schema) above so can be removed
|
} else if (StringUtils.isNotEmpty(schema.getType())) {
|
||||||
if (SchemaTypeUtil.OBJECT_TYPE.equals(schema.getType()) && schema.getAdditionalProperties() != null) {
|
LOGGER.warn("Unknown type found in the schema: " + schema.getType());
|
||||||
return "map";
|
|
||||||
} else {
|
|
||||||
return schema.getType();
|
return schema.getType();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return "object";
|
return "object";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -954,7 +954,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
|||||||
String xPath = "[\"" + escapeText(op.path) + "\"]";
|
String xPath = "[\"" + escapeText(op.path) + "\"]";
|
||||||
if (op.getHasPathParams()) {
|
if (op.getHasPathParams()) {
|
||||||
for (CodegenParameter param : op.allParams) {
|
for (CodegenParameter param : op.allParams) {
|
||||||
if(param.isPathParam) {
|
if (param.isPathParam) {
|
||||||
xPath = xPath.replaceAll("\\{" + param.baseName + "\\}", "\",toPath " + param.paramName + ",\"");
|
xPath = xPath.replaceAll("\\{" + param.baseName + "\\}", "\",toPath " + param.paramName + ",\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1195,8 +1195,8 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
|||||||
cm.isEnum = genEnums && cm.isEnum;
|
cm.isEnum = genEnums && cm.isEnum;
|
||||||
if (cm.isAlias) {
|
if (cm.isAlias) {
|
||||||
String dataType = cm.dataType;
|
String dataType = cm.dataType;
|
||||||
if(dataType == null && cm.isArrayModel) { // isAlias + arrayModelType missing "datatype"
|
if (dataType == null && cm.isArrayModel) { // isAlias + arrayModelType missing "datatype"
|
||||||
dataType = "[" + cm.arrayModelType +"]" ;
|
dataType = "[" + cm.arrayModelType + "]";
|
||||||
}
|
}
|
||||||
cm.vendorExtensions.put(X_DATA_TYPE, dataType);
|
cm.vendorExtensions.put(X_DATA_TYPE, dataType);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
## Swagger Auto-Generated [http-client](https://www.stackage.org/lts-10.0/package/http-client-0.5.7.1) Bindings to `Swagger Petstore`
|
## OpenAPI Auto-Generated [http-client](https://www.stackage.org/lts-10.0/package/http-client-0.5.7.1) Bindings to `Swagger Petstore`
|
||||||
|
|
||||||
The library in `lib` provides auto-generated-from-Swagger [http-client](https://www.stackage.org/lts-10.0/package/http-client-0.5.7.1) bindings to the Swagger Petstore API.
|
The library in `lib` provides auto-generated-from-OpenAPI [http-client](https://www.stackage.org/lts-10.0/package/http-client-0.5.7.1) bindings to the Swagger Petstore API.
|
||||||
|
|
||||||
OpenApi Version: 3.0.1
|
OpenApi Version: 3.0.0
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -29,12 +29,12 @@ from the stack.yaml file and run `stack haddock` again.
|
|||||||
stack test
|
stack test
|
||||||
```
|
```
|
||||||
|
|
||||||
## Swagger-Codegen
|
## OpenAPI-Generator
|
||||||
|
|
||||||
The code generator that produced this library, and which explains how
|
The code generator that produced this library, and which explains how
|
||||||
to obtain and use the swagger-codegen cli tool lives at
|
to obtain and use the openapi-generator cli tool lives at
|
||||||
|
|
||||||
https://github.com/swagger-api/swagger-codegen
|
https://openapi-generator.tech
|
||||||
|
|
||||||
The _language_ argument (`--lang`) passed to the cli tool used should be
|
The _language_ argument (`--lang`) passed to the cli tool used should be
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ The _language_ argument (`--lang`) passed to the cli tool used should be
|
|||||||
haskell-http-client
|
haskell-http-client
|
||||||
```
|
```
|
||||||
|
|
||||||
### Unsupported Swagger Features
|
### Unsupported OpenAPI Features
|
||||||
|
|
||||||
* Model Inheritance
|
* Model Inheritance
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ These options allow some customization of the code generation process.
|
|||||||
| configType | Set the name of the type used for configuration | | SwaggerPetstoreConfig |
|
| configType | Set the name of the type used for configuration | | SwaggerPetstoreConfig |
|
||||||
| dateFormat | format string used to parse/render a date | %Y-%m-%d | %Y-%m-%d |
|
| dateFormat | format string used to parse/render a date | %Y-%m-%d | %Y-%m-%d |
|
||||||
| dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | |
|
| dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | |
|
||||||
| generateEnums | Generate specific datatypes for swagger enums | true | true |
|
| generateEnums | Generate specific datatypes for OpenAPI enums | true | true |
|
||||||
| generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | true |
|
| generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | true |
|
||||||
| generateLenses | Generate Lens optics for Models | true | true |
|
| generateLenses | Generate Lens optics for Models | true | true |
|
||||||
| generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | true |
|
| generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | true |
|
||||||
@ -80,28 +80,28 @@ These options allow some customization of the code generation process.
|
|||||||
An example setting _strictFields_ and _dateTimeFormat_:
|
An example setting _strictFields_ and _dateTimeFormat_:
|
||||||
|
|
||||||
```
|
```
|
||||||
java -jar swagger-codegen-cli.jar generate -i petstore.yaml -l haskell-http-client -o output/haskell-http-client -DstrictFields=true -DdateTimeFormat="%Y-%m-%dT%H:%M:%S%Q%z"
|
java -jar openapi-generator-cli.jar generate -i petstore.yaml -l haskell-http-client -o output/haskell-http-client -DstrictFields=true -DdateTimeFormat="%Y-%m-%dT%H:%M:%S%Q%z"
|
||||||
```
|
```
|
||||||
|
|
||||||
View the full list of Codegen "config option" parameters with the command:
|
View the full list of Codegen "config option" parameters with the command:
|
||||||
|
|
||||||
```
|
```
|
||||||
java -jar swagger-codegen-cli.jar config-help -l haskell-http-client
|
java -jar openapi-generator-cli.jar config-help -l haskell-http-client
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage Notes
|
## Usage Notes
|
||||||
|
|
||||||
### Example SwaggerPetstore Haddock documentation
|
### Example Petstore Haddock documentation
|
||||||
|
|
||||||
An example of the generated haddock documentation targeting the server http://petstore.swagger.io/ (SwaggerPetstore) can be found [here][2]
|
An example of the generated haddock documentation targeting the server http://petstore.swagger.io/ (Petstore) can be found [here][2]
|
||||||
|
|
||||||
[2]: https://hackage.haskell.org/package/swagger-petstore
|
[2]: https://hackage.haskell.org/package/swagger-petstore
|
||||||
|
|
||||||
### Example SwaggerPetstore App
|
### Example Petstore App
|
||||||
|
|
||||||
An example application using the auto-generated haskell-http-client bindings for the server http://petstore.swagger.io/ can be found [here][3]
|
An example application using the auto-generated haskell-http-client bindings for the server http://petstore.swagger.io/ can be found [here][3]
|
||||||
|
|
||||||
[3]: https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/haskell-http-client/example-app
|
[3]: https://github.com/openapitools/openapi-generator/master/samples/client/petstore/haskell-http-client/example-app
|
||||||
|
|
||||||
This library is intended to be imported qualified.
|
This library is intended to be imported qualified.
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ This library is intended to be imported qualified.
|
|||||||
|
|
||||||
### MimeTypes
|
### MimeTypes
|
||||||
|
|
||||||
This library adds type safety around what swagger specifies as
|
This library adds type safety around what OpenAPI specifies as
|
||||||
Produces and Consumes for each Operation (e.g. the list of MIME types an
|
Produces and Consumes for each Operation (e.g. the list of MIME types an
|
||||||
Operation can Produce (using 'accept' headers) and Consume (using 'content-type' headers).
|
Operation can Produce (using 'accept' headers) and Consume (using 'content-type' headers).
|
||||||
|
|
||||||
@ -153,10 +153,10 @@ this would indicate that:
|
|||||||
* the _addFoo_ operation can set it's body param of _FooModel_ via `setBodyParam`
|
* the _addFoo_ operation can set it's body param of _FooModel_ via `setBodyParam`
|
||||||
* the _addFoo_ operation can set 2 different optional parameters via `applyOptionalParam`
|
* the _addFoo_ operation can set 2 different optional parameters via `applyOptionalParam`
|
||||||
|
|
||||||
If the swagger spec doesn't declare it can accept or produce a certain
|
If the OpenAPI spec doesn't declare it can accept or produce a certain
|
||||||
MIME type for a given Operation, you should either add a Produces or
|
MIME type for a given Operation, you should either add a Produces or
|
||||||
Consumes instance for the desired MIME types (assuming the server
|
Consumes instance for the desired MIME types (assuming the server
|
||||||
supports it), use `dispatchLbsUnsafe` or modify the swagger spec and
|
supports it), use `dispatchLbsUnsafe` or modify the OpenAPI spec and
|
||||||
run the generator again.
|
run the generator again.
|
||||||
|
|
||||||
New MIME type instances can be added via MimeType/MimeRender/MimeUnrender
|
New MIME type instances can be added via MimeType/MimeRender/MimeUnrender
|
||||||
@ -168,7 +168,7 @@ Operations using x-www-form-urlencoded which use those models.
|
|||||||
|
|
||||||
### Authentication
|
### Authentication
|
||||||
|
|
||||||
A haskell data type will be generated for each swagger authentication type.
|
A haskell data type will be generated for each OpenAPI authentication type.
|
||||||
|
|
||||||
If for example the AuthMethod `AuthOAuthFoo` is generated for OAuth operations, then
|
If for example the AuthMethod `AuthOAuthFoo` is generated for OAuth operations, then
|
||||||
`addAuthMethod` should be used to add the AuthMethod config.
|
`addAuthMethod` should be used to add the AuthMethod config.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
#
|
#
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
|
||||||
|
|
||||||
git_user_id=$1
|
git_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
@ -65,17 +65,19 @@ import qualified Prelude as P
|
|||||||
-- Test serialization of outer boolean types
|
-- Test serialization of outer boolean types
|
||||||
--
|
--
|
||||||
fakeOuterBooleanSerialize
|
fakeOuterBooleanSerialize
|
||||||
:: (Consumes FakeOuterBooleanSerialize contentType)
|
:: (Consumes FakeOuterBooleanSerialize MimeJSON)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> Accept accept -- ^ request accept ('MimeType')
|
||||||
-> Accept accept -- ^ request accept ('MimeType')
|
-> SwaggerPetstoreRequest FakeOuterBooleanSerialize MimeJSON Bool accept
|
||||||
-> SwaggerPetstoreRequest FakeOuterBooleanSerialize contentType OuterBoolean accept
|
fakeOuterBooleanSerialize _ =
|
||||||
fakeOuterBooleanSerialize _ _ =
|
|
||||||
_mkRequest "POST" ["/fake/outer/boolean"]
|
_mkRequest "POST" ["/fake/outer/boolean"]
|
||||||
|
|
||||||
data FakeOuterBooleanSerialize
|
data FakeOuterBooleanSerialize
|
||||||
|
|
||||||
-- | /Body Param/ "boolean_post_body" - Input boolean as post body
|
-- | /Body Param/ "body" - Input boolean as post body
|
||||||
instance HasBodyParam FakeOuterBooleanSerialize BooleanPostBody
|
instance HasBodyParam FakeOuterBooleanSerialize BodyBool
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes FakeOuterBooleanSerialize MimeJSON
|
||||||
|
|
||||||
-- | @*/*@
|
-- | @*/*@
|
||||||
instance MimeType mtype => Produces FakeOuterBooleanSerialize mtype
|
instance MimeType mtype => Produces FakeOuterBooleanSerialize mtype
|
||||||
@ -88,11 +90,10 @@ instance MimeType mtype => Produces FakeOuterBooleanSerialize mtype
|
|||||||
-- Test serialization of object with outer number type
|
-- Test serialization of object with outer number type
|
||||||
--
|
--
|
||||||
fakeOuterCompositeSerialize
|
fakeOuterCompositeSerialize
|
||||||
:: (Consumes FakeOuterCompositeSerialize contentType)
|
:: (Consumes FakeOuterCompositeSerialize MimeJSON)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> Accept accept -- ^ request accept ('MimeType')
|
||||||
-> Accept accept -- ^ request accept ('MimeType')
|
-> SwaggerPetstoreRequest FakeOuterCompositeSerialize MimeJSON OuterComposite accept
|
||||||
-> SwaggerPetstoreRequest FakeOuterCompositeSerialize contentType OuterComposite accept
|
fakeOuterCompositeSerialize _ =
|
||||||
fakeOuterCompositeSerialize _ _ =
|
|
||||||
_mkRequest "POST" ["/fake/outer/composite"]
|
_mkRequest "POST" ["/fake/outer/composite"]
|
||||||
|
|
||||||
data FakeOuterCompositeSerialize
|
data FakeOuterCompositeSerialize
|
||||||
@ -100,6 +101,9 @@ data FakeOuterCompositeSerialize
|
|||||||
-- | /Body Param/ "OuterComposite" - Input composite as post body
|
-- | /Body Param/ "OuterComposite" - Input composite as post body
|
||||||
instance HasBodyParam FakeOuterCompositeSerialize OuterComposite
|
instance HasBodyParam FakeOuterCompositeSerialize OuterComposite
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes FakeOuterCompositeSerialize MimeJSON
|
||||||
|
|
||||||
-- | @*/*@
|
-- | @*/*@
|
||||||
instance MimeType mtype => Produces FakeOuterCompositeSerialize mtype
|
instance MimeType mtype => Produces FakeOuterCompositeSerialize mtype
|
||||||
|
|
||||||
@ -111,11 +115,10 @@ instance MimeType mtype => Produces FakeOuterCompositeSerialize mtype
|
|||||||
-- Test serialization of outer number types
|
-- Test serialization of outer number types
|
||||||
--
|
--
|
||||||
fakeOuterNumberSerialize
|
fakeOuterNumberSerialize
|
||||||
:: (Consumes FakeOuterNumberSerialize contentType)
|
:: (Consumes FakeOuterNumberSerialize MimeJSON)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> Accept accept -- ^ request accept ('MimeType')
|
||||||
-> Accept accept -- ^ request accept ('MimeType')
|
-> SwaggerPetstoreRequest FakeOuterNumberSerialize MimeJSON Double accept
|
||||||
-> SwaggerPetstoreRequest FakeOuterNumberSerialize contentType OuterNumber accept
|
fakeOuterNumberSerialize _ =
|
||||||
fakeOuterNumberSerialize _ _ =
|
|
||||||
_mkRequest "POST" ["/fake/outer/number"]
|
_mkRequest "POST" ["/fake/outer/number"]
|
||||||
|
|
||||||
data FakeOuterNumberSerialize
|
data FakeOuterNumberSerialize
|
||||||
@ -123,6 +126,9 @@ data FakeOuterNumberSerialize
|
|||||||
-- | /Body Param/ "body" - Input number as post body
|
-- | /Body Param/ "body" - Input number as post body
|
||||||
instance HasBodyParam FakeOuterNumberSerialize Body
|
instance HasBodyParam FakeOuterNumberSerialize Body
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes FakeOuterNumberSerialize MimeJSON
|
||||||
|
|
||||||
-- | @*/*@
|
-- | @*/*@
|
||||||
instance MimeType mtype => Produces FakeOuterNumberSerialize mtype
|
instance MimeType mtype => Produces FakeOuterNumberSerialize mtype
|
||||||
|
|
||||||
@ -134,11 +140,10 @@ instance MimeType mtype => Produces FakeOuterNumberSerialize mtype
|
|||||||
-- Test serialization of outer string types
|
-- Test serialization of outer string types
|
||||||
--
|
--
|
||||||
fakeOuterStringSerialize
|
fakeOuterStringSerialize
|
||||||
:: (Consumes FakeOuterStringSerialize contentType)
|
:: (Consumes FakeOuterStringSerialize MimeJSON)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> Accept accept -- ^ request accept ('MimeType')
|
||||||
-> Accept accept -- ^ request accept ('MimeType')
|
-> SwaggerPetstoreRequest FakeOuterStringSerialize MimeJSON Text accept
|
||||||
-> SwaggerPetstoreRequest FakeOuterStringSerialize contentType OuterString accept
|
fakeOuterStringSerialize _ =
|
||||||
fakeOuterStringSerialize _ _ =
|
|
||||||
_mkRequest "POST" ["/fake/outer/string"]
|
_mkRequest "POST" ["/fake/outer/string"]
|
||||||
|
|
||||||
data FakeOuterStringSerialize
|
data FakeOuterStringSerialize
|
||||||
@ -146,33 +151,13 @@ data FakeOuterStringSerialize
|
|||||||
-- | /Body Param/ "body" - Input string as post body
|
-- | /Body Param/ "body" - Input string as post body
|
||||||
instance HasBodyParam FakeOuterStringSerialize BodyText
|
instance HasBodyParam FakeOuterStringSerialize BodyText
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes FakeOuterStringSerialize MimeJSON
|
||||||
|
|
||||||
-- | @*/*@
|
-- | @*/*@
|
||||||
instance MimeType mtype => Produces FakeOuterStringSerialize mtype
|
instance MimeType mtype => Produces FakeOuterStringSerialize mtype
|
||||||
|
|
||||||
|
|
||||||
-- *** testBodyWithQueryParams
|
|
||||||
|
|
||||||
-- | @PUT \/fake\/body-with-query-params@
|
|
||||||
--
|
|
||||||
testBodyWithQueryParams
|
|
||||||
:: (Consumes TestBodyWithQueryParams MimeJSON, MimeRender MimeJSON User)
|
|
||||||
=> User -- ^ "user"
|
|
||||||
-> Query -- ^ "query"
|
|
||||||
-> SwaggerPetstoreRequest TestBodyWithQueryParams MimeJSON NoContent MimeNoContent
|
|
||||||
testBodyWithQueryParams user (Query query) =
|
|
||||||
_mkRequest "PUT" ["/fake/body-with-query-params"]
|
|
||||||
`setBodyParam` user
|
|
||||||
`setQuery` toQuery ("query", Just query)
|
|
||||||
|
|
||||||
data TestBodyWithQueryParams
|
|
||||||
instance HasBodyParam TestBodyWithQueryParams User
|
|
||||||
|
|
||||||
-- | @application/json@
|
|
||||||
instance Consumes TestBodyWithQueryParams MimeJSON
|
|
||||||
|
|
||||||
instance Produces TestBodyWithQueryParams MimeNoContent
|
|
||||||
|
|
||||||
|
|
||||||
-- *** testClientModel
|
-- *** testClientModel
|
||||||
|
|
||||||
-- | @PATCH \/fake@
|
-- | @PATCH \/fake@
|
||||||
@ -323,7 +308,7 @@ instance HasOptionalParam TestEnumParameters EnumHeaderString where
|
|||||||
-- | /Optional Param/ "enum_query_string_array" - Query parameter enum test (string array)
|
-- | /Optional Param/ "enum_query_string_array" - Query parameter enum test (string array)
|
||||||
instance HasOptionalParam TestEnumParameters EnumQueryStringArray where
|
instance HasOptionalParam TestEnumParameters EnumQueryStringArray where
|
||||||
applyOptionalParam req (EnumQueryStringArray xs) =
|
applyOptionalParam req (EnumQueryStringArray xs) =
|
||||||
req `setQuery` toQueryColl CommaSeparated ("enum_query_string_array", Just xs)
|
req `setQuery` toQueryColl MultiParamArray ("enum_query_string_array", Just xs)
|
||||||
|
|
||||||
-- | /Optional Param/ "enum_query_string" - Query parameter enum test (string)
|
-- | /Optional Param/ "enum_query_string" - Query parameter enum test (string)
|
||||||
instance HasOptionalParam TestEnumParameters EnumQueryString where
|
instance HasOptionalParam TestEnumParameters EnumQueryString where
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
@ -81,10 +81,10 @@ data AddPet
|
|||||||
-- | /Body Param/ "Pet" - Pet object that needs to be added to the store
|
-- | /Body Param/ "Pet" - Pet object that needs to be added to the store
|
||||||
instance HasBodyParam AddPet Pet
|
instance HasBodyParam AddPet Pet
|
||||||
|
|
||||||
-- | @application/json@
|
|
||||||
instance Consumes AddPet MimeJSON
|
|
||||||
-- | @application/xml@
|
-- | @application/xml@
|
||||||
instance Consumes AddPet MimeXML
|
instance Consumes AddPet MimeXML
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes AddPet MimeJSON
|
||||||
|
|
||||||
instance Produces AddPet MimeNoContent
|
instance Produces AddPet MimeNoContent
|
||||||
|
|
||||||
@ -217,10 +217,10 @@ data UpdatePet
|
|||||||
-- | /Body Param/ "Pet" - Pet object that needs to be added to the store
|
-- | /Body Param/ "Pet" - Pet object that needs to be added to the store
|
||||||
instance HasBodyParam UpdatePet Pet
|
instance HasBodyParam UpdatePet Pet
|
||||||
|
|
||||||
-- | @application/json@
|
|
||||||
instance Consumes UpdatePet MimeJSON
|
|
||||||
-- | @application/xml@
|
-- | @application/xml@
|
||||||
instance Consumes UpdatePet MimeXML
|
instance Consumes UpdatePet MimeXML
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes UpdatePet MimeJSON
|
||||||
|
|
||||||
instance Produces UpdatePet MimeNoContent
|
instance Produces UpdatePet MimeNoContent
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
@ -129,12 +129,11 @@ instance Produces GetOrderById MimeJSON
|
|||||||
-- Place an order for a pet
|
-- Place an order for a pet
|
||||||
--
|
--
|
||||||
placeOrder
|
placeOrder
|
||||||
:: (Consumes PlaceOrder contentType, MimeRender contentType Order)
|
:: (Consumes PlaceOrder MimeJSON, MimeRender MimeJSON Order)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> Accept accept -- ^ request accept ('MimeType')
|
||||||
-> Accept accept -- ^ request accept ('MimeType')
|
|
||||||
-> Order -- ^ "order" - order placed for purchasing the pet
|
-> Order -- ^ "order" - order placed for purchasing the pet
|
||||||
-> SwaggerPetstoreRequest PlaceOrder contentType Order accept
|
-> SwaggerPetstoreRequest PlaceOrder MimeJSON Order accept
|
||||||
placeOrder _ _ order =
|
placeOrder _ order =
|
||||||
_mkRequest "POST" ["/store/order"]
|
_mkRequest "POST" ["/store/order"]
|
||||||
`setBodyParam` order
|
`setBodyParam` order
|
||||||
|
|
||||||
@ -143,6 +142,9 @@ data PlaceOrder
|
|||||||
-- | /Body Param/ "Order" - order placed for purchasing the pet
|
-- | /Body Param/ "Order" - order placed for purchasing the pet
|
||||||
instance HasBodyParam PlaceOrder Order
|
instance HasBodyParam PlaceOrder Order
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes PlaceOrder MimeJSON
|
||||||
|
|
||||||
-- | @application/xml@
|
-- | @application/xml@
|
||||||
instance Produces PlaceOrder MimeXML
|
instance Produces PlaceOrder MimeXML
|
||||||
-- | @application/json@
|
-- | @application/json@
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
@ -67,11 +67,10 @@ import qualified Prelude as P
|
|||||||
-- This can only be done by the logged in user.
|
-- This can only be done by the logged in user.
|
||||||
--
|
--
|
||||||
createUser
|
createUser
|
||||||
:: (Consumes CreateUser contentType, MimeRender contentType User)
|
:: (Consumes CreateUser MimeJSON, MimeRender MimeJSON User)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> User -- ^ "user" - Created user object
|
||||||
-> User -- ^ "user" - Created user object
|
-> SwaggerPetstoreRequest CreateUser MimeJSON NoContent MimeNoContent
|
||||||
-> SwaggerPetstoreRequest CreateUser contentType NoContent MimeNoContent
|
createUser user =
|
||||||
createUser _ user =
|
|
||||||
_mkRequest "POST" ["/user"]
|
_mkRequest "POST" ["/user"]
|
||||||
`setBodyParam` user
|
`setBodyParam` user
|
||||||
|
|
||||||
@ -80,6 +79,9 @@ data CreateUser
|
|||||||
-- | /Body Param/ "User" - Created user object
|
-- | /Body Param/ "User" - Created user object
|
||||||
instance HasBodyParam CreateUser User
|
instance HasBodyParam CreateUser User
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes CreateUser MimeJSON
|
||||||
|
|
||||||
instance Produces CreateUser MimeNoContent
|
instance Produces CreateUser MimeNoContent
|
||||||
|
|
||||||
|
|
||||||
@ -90,11 +92,10 @@ instance Produces CreateUser MimeNoContent
|
|||||||
-- Creates list of users with given input array
|
-- Creates list of users with given input array
|
||||||
--
|
--
|
||||||
createUsersWithArrayInput
|
createUsersWithArrayInput
|
||||||
:: (Consumes CreateUsersWithArrayInput contentType, MimeRender contentType User2)
|
:: (Consumes CreateUsersWithArrayInput MimeJSON, MimeRender MimeJSON User2)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> User2 -- ^ "user" - List of user object
|
||||||
-> User2 -- ^ "user" - List of user object
|
-> SwaggerPetstoreRequest CreateUsersWithArrayInput MimeJSON NoContent MimeNoContent
|
||||||
-> SwaggerPetstoreRequest CreateUsersWithArrayInput contentType NoContent MimeNoContent
|
createUsersWithArrayInput user =
|
||||||
createUsersWithArrayInput _ user =
|
|
||||||
_mkRequest "POST" ["/user/createWithArray"]
|
_mkRequest "POST" ["/user/createWithArray"]
|
||||||
`setBodyParam` user
|
`setBodyParam` user
|
||||||
|
|
||||||
@ -103,6 +104,9 @@ data CreateUsersWithArrayInput
|
|||||||
-- | /Body Param/ "User" - List of user object
|
-- | /Body Param/ "User" - List of user object
|
||||||
instance HasBodyParam CreateUsersWithArrayInput User2
|
instance HasBodyParam CreateUsersWithArrayInput User2
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes CreateUsersWithArrayInput MimeJSON
|
||||||
|
|
||||||
instance Produces CreateUsersWithArrayInput MimeNoContent
|
instance Produces CreateUsersWithArrayInput MimeNoContent
|
||||||
|
|
||||||
|
|
||||||
@ -113,11 +117,10 @@ instance Produces CreateUsersWithArrayInput MimeNoContent
|
|||||||
-- Creates list of users with given input array
|
-- Creates list of users with given input array
|
||||||
--
|
--
|
||||||
createUsersWithListInput
|
createUsersWithListInput
|
||||||
:: (Consumes CreateUsersWithListInput contentType, MimeRender contentType User2)
|
:: (Consumes CreateUsersWithListInput MimeJSON, MimeRender MimeJSON User2)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> User2 -- ^ "user" - List of user object
|
||||||
-> User2 -- ^ "user" - List of user object
|
-> SwaggerPetstoreRequest CreateUsersWithListInput MimeJSON NoContent MimeNoContent
|
||||||
-> SwaggerPetstoreRequest CreateUsersWithListInput contentType NoContent MimeNoContent
|
createUsersWithListInput user =
|
||||||
createUsersWithListInput _ user =
|
|
||||||
_mkRequest "POST" ["/user/createWithList"]
|
_mkRequest "POST" ["/user/createWithList"]
|
||||||
`setBodyParam` user
|
`setBodyParam` user
|
||||||
|
|
||||||
@ -126,6 +129,9 @@ data CreateUsersWithListInput
|
|||||||
-- | /Body Param/ "User" - List of user object
|
-- | /Body Param/ "User" - List of user object
|
||||||
instance HasBodyParam CreateUsersWithListInput User2
|
instance HasBodyParam CreateUsersWithListInput User2
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes CreateUsersWithListInput MimeJSON
|
||||||
|
|
||||||
instance Produces CreateUsersWithListInput MimeNoContent
|
instance Produces CreateUsersWithListInput MimeNoContent
|
||||||
|
|
||||||
|
|
||||||
@ -218,12 +224,11 @@ instance Produces LogoutUser MimeNoContent
|
|||||||
-- This can only be done by the logged in user.
|
-- This can only be done by the logged in user.
|
||||||
--
|
--
|
||||||
updateUser
|
updateUser
|
||||||
:: (Consumes UpdateUser contentType, MimeRender contentType User)
|
:: (Consumes UpdateUser MimeJSON, MimeRender MimeJSON User)
|
||||||
=> ContentType contentType -- ^ request content-type ('MimeType')
|
=> User -- ^ "user" - Updated user object
|
||||||
-> User -- ^ "user" - Updated user object
|
|
||||||
-> Username -- ^ "username" - name that need to be deleted
|
-> Username -- ^ "username" - name that need to be deleted
|
||||||
-> SwaggerPetstoreRequest UpdateUser contentType NoContent MimeNoContent
|
-> SwaggerPetstoreRequest UpdateUser MimeJSON NoContent MimeNoContent
|
||||||
updateUser _ user (Username username) =
|
updateUser user (Username username) =
|
||||||
_mkRequest "PUT" ["/user/",toPath username]
|
_mkRequest "PUT" ["/user/",toPath username]
|
||||||
`setBodyParam` user
|
`setBodyParam` user
|
||||||
|
|
||||||
@ -232,5 +237,8 @@ data UpdateUser
|
|||||||
-- | /Body Param/ "User" - Updated user object
|
-- | /Body Param/ "User" - Updated user object
|
||||||
instance HasBodyParam UpdateUser User
|
instance HasBodyParam UpdateUser User
|
||||||
|
|
||||||
|
-- | @application/json@
|
||||||
|
instance Consumes UpdateUser MimeJSON
|
||||||
|
|
||||||
instance Produces UpdateUser MimeNoContent
|
instance Produces UpdateUser MimeNoContent
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
@ -316,7 +316,7 @@ toQuery :: WH.ToHttpApiData a => (BC.ByteString, Maybe a) -> [NH.QueryItem]
|
|||||||
toQuery x = [(fmap . fmap) toQueryParam x]
|
toQuery x = [(fmap . fmap) toQueryParam x]
|
||||||
where toQueryParam = T.encodeUtf8 . WH.toQueryParam
|
where toQueryParam = T.encodeUtf8 . WH.toQueryParam
|
||||||
|
|
||||||
-- *** Swagger `CollectionFormat` Utils
|
-- *** OpenAPI `CollectionFormat` Utils
|
||||||
|
|
||||||
-- | Determines the format of the array if type array is used.
|
-- | Determines the format of the array if type array is used.
|
||||||
data CollectionFormat
|
data CollectionFormat
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
@ -76,12 +76,12 @@ newtype ApiKey = ApiKey { unApiKey :: Text } deriving (P.Eq, P.Show)
|
|||||||
-- ** Body
|
-- ** Body
|
||||||
newtype Body = Body { unBody :: Double } deriving (P.Eq, P.Show, A.ToJSON)
|
newtype Body = Body { unBody :: Double } deriving (P.Eq, P.Show, A.ToJSON)
|
||||||
|
|
||||||
|
-- ** BodyBool
|
||||||
|
newtype BodyBool = BodyBool { unBodyBool :: Bool } deriving (P.Eq, P.Show, A.ToJSON)
|
||||||
|
|
||||||
-- ** BodyText
|
-- ** BodyText
|
||||||
newtype BodyText = BodyText { unBodyText :: Text } deriving (P.Eq, P.Show, A.ToJSON)
|
newtype BodyText = BodyText { unBodyText :: Text } deriving (P.Eq, P.Show, A.ToJSON)
|
||||||
|
|
||||||
-- ** BooleanPostBody
|
|
||||||
newtype BooleanPostBody = BooleanPostBody { unBooleanPostBody :: Bool } deriving (P.Eq, P.Show, A.ToJSON)
|
|
||||||
|
|
||||||
-- ** Byte
|
-- ** Byte
|
||||||
newtype Byte = Byte { unByte :: ByteArray } deriving (P.Eq, P.Show)
|
newtype Byte = Byte { unByte :: ByteArray } deriving (P.Eq, P.Show)
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ newtype Callback = Callback { unCallback :: Text } deriving (P.Eq, P.Show)
|
|||||||
newtype EnumFormString = EnumFormString { unEnumFormString :: E'EnumFormString } deriving (P.Eq, P.Show)
|
newtype EnumFormString = EnumFormString { unEnumFormString :: E'EnumFormString } deriving (P.Eq, P.Show)
|
||||||
|
|
||||||
-- ** EnumFormStringArray
|
-- ** EnumFormStringArray
|
||||||
newtype EnumFormStringArray = EnumFormStringArray { unEnumFormStringArray :: [E'EnumFormStringArray] } deriving (P.Eq, P.Show)
|
newtype EnumFormStringArray = EnumFormStringArray { unEnumFormStringArray :: E'EnumFormStringArray } deriving (P.Eq, P.Show)
|
||||||
|
|
||||||
-- ** EnumHeaderString
|
-- ** EnumHeaderString
|
||||||
newtype EnumHeaderString = EnumHeaderString { unEnumHeaderString :: E'EnumFormString } deriving (P.Eq, P.Show)
|
newtype EnumHeaderString = EnumHeaderString { unEnumHeaderString :: E'EnumFormString } deriving (P.Eq, P.Show)
|
||||||
@ -169,9 +169,6 @@ newtype PatternWithoutDelimiter = PatternWithoutDelimiter { unPatternWithoutDeli
|
|||||||
-- ** PetId
|
-- ** PetId
|
||||||
newtype PetId = PetId { unPetId :: Integer } deriving (P.Eq, P.Show)
|
newtype PetId = PetId { unPetId :: Integer } deriving (P.Eq, P.Show)
|
||||||
|
|
||||||
-- ** Query
|
|
||||||
newtype Query = Query { unQuery :: Text } deriving (P.Eq, P.Show)
|
|
||||||
|
|
||||||
-- ** RequestBody
|
-- ** RequestBody
|
||||||
newtype RequestBody = RequestBody { unRequestBody :: Text } deriving (P.Eq, P.Show, A.ToJSON)
|
newtype RequestBody = RequestBody { unRequestBody :: Text } deriving (P.Eq, P.Show, A.ToJSON)
|
||||||
|
|
||||||
@ -260,10 +257,31 @@ mkAnimal animalClassName =
|
|||||||
|
|
||||||
-- ** AnimalFarm
|
-- ** AnimalFarm
|
||||||
-- | AnimalFarm
|
-- | AnimalFarm
|
||||||
newtype AnimalFarm = AnimalFarm
|
data AnimalFarm = AnimalFarm
|
||||||
{ unAnimalFarm :: [Animal]
|
{
|
||||||
} deriving (P.Eq, P.Show, P.Typeable, A.ToJSON, A.FromJSON)
|
} deriving (P.Show, P.Eq, P.Typeable)
|
||||||
|
|
||||||
|
-- | FromJSON AnimalFarm
|
||||||
|
instance A.FromJSON AnimalFarm where
|
||||||
|
parseJSON = A.withObject "AnimalFarm" $ \o ->
|
||||||
|
pure AnimalFarm
|
||||||
|
|
||||||
|
|
||||||
|
-- | ToJSON AnimalFarm
|
||||||
|
instance A.ToJSON AnimalFarm where
|
||||||
|
toJSON AnimalFarm =
|
||||||
|
_omitNulls
|
||||||
|
[
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
-- | Construct a value of type 'AnimalFarm' (by applying it's required fields, if any)
|
||||||
|
mkAnimalFarm
|
||||||
|
:: AnimalFarm
|
||||||
|
mkAnimalFarm =
|
||||||
|
AnimalFarm
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
-- ** ApiResponse
|
-- ** ApiResponse
|
||||||
-- | ApiResponse
|
-- | ApiResponse
|
||||||
@ -897,7 +915,7 @@ mkModel200Response =
|
|||||||
-- ** ModelList
|
-- ** ModelList
|
||||||
-- | ModelList
|
-- | ModelList
|
||||||
data ModelList = ModelList
|
data ModelList = ModelList
|
||||||
{ modelList123List :: !(Maybe Text) -- ^ "123-list"
|
{ modelList123list :: !(Maybe Text) -- ^ "123-list"
|
||||||
} deriving (P.Show, P.Eq, P.Typeable)
|
} deriving (P.Show, P.Eq, P.Typeable)
|
||||||
|
|
||||||
-- | FromJSON ModelList
|
-- | FromJSON ModelList
|
||||||
@ -910,7 +928,7 @@ instance A.FromJSON ModelList where
|
|||||||
instance A.ToJSON ModelList where
|
instance A.ToJSON ModelList where
|
||||||
toJSON ModelList {..} =
|
toJSON ModelList {..} =
|
||||||
_omitNulls
|
_omitNulls
|
||||||
[ "123-list" .= modelList123List
|
[ "123-list" .= modelList123list
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -919,7 +937,7 @@ mkModelList
|
|||||||
:: ModelList
|
:: ModelList
|
||||||
mkModelList =
|
mkModelList =
|
||||||
ModelList
|
ModelList
|
||||||
{ modelList123List = Nothing
|
{ modelList123list = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ** ModelReturn
|
-- ** ModelReturn
|
||||||
@ -958,7 +976,7 @@ data Name = Name
|
|||||||
{ nameName :: !(Int) -- ^ /Required/ "name"
|
{ nameName :: !(Int) -- ^ /Required/ "name"
|
||||||
, nameSnakeCase :: !(Maybe Int) -- ^ "snake_case"
|
, nameSnakeCase :: !(Maybe Int) -- ^ "snake_case"
|
||||||
, nameProperty :: !(Maybe Text) -- ^ "property"
|
, nameProperty :: !(Maybe Text) -- ^ "property"
|
||||||
, name123Number :: !(Maybe Int) -- ^ "123Number"
|
, name123number :: !(Maybe Int) -- ^ "123Number"
|
||||||
} deriving (P.Show, P.Eq, P.Typeable)
|
} deriving (P.Show, P.Eq, P.Typeable)
|
||||||
|
|
||||||
-- | FromJSON Name
|
-- | FromJSON Name
|
||||||
@ -977,7 +995,7 @@ instance A.ToJSON Name where
|
|||||||
[ "name" .= nameName
|
[ "name" .= nameName
|
||||||
, "snake_case" .= nameSnakeCase
|
, "snake_case" .= nameSnakeCase
|
||||||
, "property" .= nameProperty
|
, "property" .= nameProperty
|
||||||
, "123Number" .= name123Number
|
, "123Number" .= name123number
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -990,7 +1008,7 @@ mkName nameName =
|
|||||||
{ nameName
|
{ nameName
|
||||||
, nameSnakeCase = Nothing
|
, nameSnakeCase = Nothing
|
||||||
, nameProperty = Nothing
|
, nameProperty = Nothing
|
||||||
, name123Number = Nothing
|
, name123number = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ** NumberOnly
|
-- ** NumberOnly
|
||||||
@ -1069,19 +1087,12 @@ mkOrder =
|
|||||||
, orderComplete = Nothing
|
, orderComplete = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ** OuterBoolean
|
|
||||||
-- | OuterBoolean
|
|
||||||
newtype OuterBoolean = OuterBoolean
|
|
||||||
{ unOuterBoolean :: Bool
|
|
||||||
} deriving (P.Eq, P.Show, P.Typeable, A.ToJSON, A.FromJSON)
|
|
||||||
|
|
||||||
|
|
||||||
-- ** OuterComposite
|
-- ** OuterComposite
|
||||||
-- | OuterComposite
|
-- | OuterComposite
|
||||||
data OuterComposite = OuterComposite
|
data OuterComposite = OuterComposite
|
||||||
{ outerCompositeMyNumber :: !(Maybe OuterNumber) -- ^ "my_number"
|
{ outerCompositeMyNumber :: !(Maybe Double) -- ^ "my_number"
|
||||||
, outerCompositeMyString :: !(Maybe OuterString) -- ^ "my_string"
|
, outerCompositeMyString :: !(Maybe Text) -- ^ "my_string"
|
||||||
, outerCompositeMyBoolean :: !(Maybe OuterBoolean) -- ^ "my_boolean"
|
, outerCompositeMyBoolean :: !(Maybe Bool) -- ^ "my_boolean"
|
||||||
} deriving (P.Show, P.Eq, P.Typeable)
|
} deriving (P.Show, P.Eq, P.Typeable)
|
||||||
|
|
||||||
-- | FromJSON OuterComposite
|
-- | FromJSON OuterComposite
|
||||||
@ -1112,20 +1123,6 @@ mkOuterComposite =
|
|||||||
, outerCompositeMyBoolean = Nothing
|
, outerCompositeMyBoolean = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ** OuterNumber
|
|
||||||
-- | OuterNumber
|
|
||||||
newtype OuterNumber = OuterNumber
|
|
||||||
{ unOuterNumber :: Double
|
|
||||||
} deriving (P.Eq, P.Show, P.Typeable, A.ToJSON, A.FromJSON)
|
|
||||||
|
|
||||||
|
|
||||||
-- ** OuterString
|
|
||||||
-- | OuterString
|
|
||||||
newtype OuterString = OuterString
|
|
||||||
{ unOuterString :: Text
|
|
||||||
} deriving (P.Eq, P.Show, P.Typeable, A.ToJSON, A.FromJSON)
|
|
||||||
|
|
||||||
|
|
||||||
-- ** Pet
|
-- ** Pet
|
||||||
-- | Pet
|
-- | Pet
|
||||||
data Pet = Pet
|
data Pet = Pet
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
OpenAPI Version: 3.0.1
|
OpenAPI Version: 3.0.0
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
Contact: apiteam@swagger.io
|
Contact: apiteam@swagger.io
|
||||||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
@ -408,10 +408,10 @@ model200ResponseClassL f Model200Response{..} = (\model200ResponseClass -> Model
|
|||||||
|
|
||||||
-- * ModelList
|
-- * ModelList
|
||||||
|
|
||||||
-- | 'modelList123List' Lens
|
-- | 'modelList123list' Lens
|
||||||
modelList123ListL :: Lens_' ModelList (Maybe Text)
|
modelList123listL :: Lens_' ModelList (Maybe Text)
|
||||||
modelList123ListL f ModelList{..} = (\modelList123List -> ModelList { modelList123List, ..} ) <$> f modelList123List
|
modelList123listL f ModelList{..} = (\modelList123list -> ModelList { modelList123list, ..} ) <$> f modelList123list
|
||||||
{-# INLINE modelList123ListL #-}
|
{-# INLINE modelList123listL #-}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -441,10 +441,10 @@ namePropertyL :: Lens_' Name (Maybe Text)
|
|||||||
namePropertyL f Name{..} = (\nameProperty -> Name { nameProperty, ..} ) <$> f nameProperty
|
namePropertyL f Name{..} = (\nameProperty -> Name { nameProperty, ..} ) <$> f nameProperty
|
||||||
{-# INLINE namePropertyL #-}
|
{-# INLINE namePropertyL #-}
|
||||||
|
|
||||||
-- | 'name123Number' Lens
|
-- | 'name123number' Lens
|
||||||
name123NumberL :: Lens_' Name (Maybe Int)
|
name123numberL :: Lens_' Name (Maybe Int)
|
||||||
name123NumberL f Name{..} = (\name123Number -> Name { name123Number, ..} ) <$> f name123Number
|
name123numberL f Name{..} = (\name123number -> Name { name123number, ..} ) <$> f name123number
|
||||||
{-# INLINE name123NumberL #-}
|
{-# INLINE name123numberL #-}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -491,24 +491,20 @@ orderCompleteL f Order{..} = (\orderComplete -> Order { orderComplete, ..} ) <$>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- * OuterBoolean
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- * OuterComposite
|
-- * OuterComposite
|
||||||
|
|
||||||
-- | 'outerCompositeMyNumber' Lens
|
-- | 'outerCompositeMyNumber' Lens
|
||||||
outerCompositeMyNumberL :: Lens_' OuterComposite (Maybe OuterNumber)
|
outerCompositeMyNumberL :: Lens_' OuterComposite (Maybe Double)
|
||||||
outerCompositeMyNumberL f OuterComposite{..} = (\outerCompositeMyNumber -> OuterComposite { outerCompositeMyNumber, ..} ) <$> f outerCompositeMyNumber
|
outerCompositeMyNumberL f OuterComposite{..} = (\outerCompositeMyNumber -> OuterComposite { outerCompositeMyNumber, ..} ) <$> f outerCompositeMyNumber
|
||||||
{-# INLINE outerCompositeMyNumberL #-}
|
{-# INLINE outerCompositeMyNumberL #-}
|
||||||
|
|
||||||
-- | 'outerCompositeMyString' Lens
|
-- | 'outerCompositeMyString' Lens
|
||||||
outerCompositeMyStringL :: Lens_' OuterComposite (Maybe OuterString)
|
outerCompositeMyStringL :: Lens_' OuterComposite (Maybe Text)
|
||||||
outerCompositeMyStringL f OuterComposite{..} = (\outerCompositeMyString -> OuterComposite { outerCompositeMyString, ..} ) <$> f outerCompositeMyString
|
outerCompositeMyStringL f OuterComposite{..} = (\outerCompositeMyString -> OuterComposite { outerCompositeMyString, ..} ) <$> f outerCompositeMyString
|
||||||
{-# INLINE outerCompositeMyStringL #-}
|
{-# INLINE outerCompositeMyStringL #-}
|
||||||
|
|
||||||
-- | 'outerCompositeMyBoolean' Lens
|
-- | 'outerCompositeMyBoolean' Lens
|
||||||
outerCompositeMyBooleanL :: Lens_' OuterComposite (Maybe OuterBoolean)
|
outerCompositeMyBooleanL :: Lens_' OuterComposite (Maybe Bool)
|
||||||
outerCompositeMyBooleanL f OuterComposite{..} = (\outerCompositeMyBoolean -> OuterComposite { outerCompositeMyBoolean, ..} ) <$> f outerCompositeMyBoolean
|
outerCompositeMyBooleanL f OuterComposite{..} = (\outerCompositeMyBoolean -> OuterComposite { outerCompositeMyBoolean, ..} ) <$> f outerCompositeMyBoolean
|
||||||
{-# INLINE outerCompositeMyBooleanL #-}
|
{-# INLINE outerCompositeMyBooleanL #-}
|
||||||
|
|
||||||
@ -518,14 +514,6 @@ outerCompositeMyBooleanL f OuterComposite{..} = (\outerCompositeMyBoolean -> Out
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- * OuterNumber
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- * OuterString
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- * Pet
|
-- * Pet
|
||||||
|
|
||||||
-- | 'petId' Lens
|
-- | 'petId' Lens
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -10,10 +10,10 @@ description: .
|
|||||||
.
|
.
|
||||||
Swagger Petstore API version: 1.0.0
|
Swagger Petstore API version: 1.0.0
|
||||||
.
|
.
|
||||||
OpenAPI version: 3.0.1
|
OpenAPI version: 3.0.0
|
||||||
.
|
.
|
||||||
category: Web
|
category: Web
|
||||||
homepage: https://github.com/swagger-api/swagger-codegen#readme
|
homepage: https://openapi-generator.tech
|
||||||
author: Author Name Here
|
author: Author Name Here
|
||||||
maintainer: author.name@email.com
|
maintainer: author.name@email.com
|
||||||
copyright: YEAR - AUTHOR
|
copyright: YEAR - AUTHOR
|
||||||
|
@ -103,7 +103,9 @@ instance Arbitrary Animal where
|
|||||||
|
|
||||||
instance Arbitrary AnimalFarm where
|
instance Arbitrary AnimalFarm where
|
||||||
arbitrary =
|
arbitrary =
|
||||||
AnimalFarm <$> arbitrary
|
|
||||||
|
pure AnimalFarm
|
||||||
|
|
||||||
instance Arbitrary ApiResponse where
|
instance Arbitrary ApiResponse where
|
||||||
arbitrary =
|
arbitrary =
|
||||||
ApiResponse
|
ApiResponse
|
||||||
@ -228,7 +230,7 @@ instance Arbitrary Model200Response where
|
|||||||
instance Arbitrary ModelList where
|
instance Arbitrary ModelList where
|
||||||
arbitrary =
|
arbitrary =
|
||||||
ModelList
|
ModelList
|
||||||
<$> arbitrary -- modelList123List :: Maybe Text
|
<$> arbitrary -- modelList123list :: Maybe Text
|
||||||
|
|
||||||
instance Arbitrary ModelReturn where
|
instance Arbitrary ModelReturn where
|
||||||
arbitrary =
|
arbitrary =
|
||||||
@ -241,7 +243,7 @@ instance Arbitrary Name where
|
|||||||
<$> arbitrary -- nameName :: Int
|
<$> arbitrary -- nameName :: Int
|
||||||
<*> arbitrary -- nameSnakeCase :: Maybe Int
|
<*> arbitrary -- nameSnakeCase :: Maybe Int
|
||||||
<*> arbitrary -- nameProperty :: Maybe Text
|
<*> arbitrary -- nameProperty :: Maybe Text
|
||||||
<*> arbitrary -- name123Number :: Maybe Int
|
<*> arbitrary -- name123number :: Maybe Int
|
||||||
|
|
||||||
instance Arbitrary NumberOnly where
|
instance Arbitrary NumberOnly where
|
||||||
arbitrary =
|
arbitrary =
|
||||||
@ -258,22 +260,13 @@ instance Arbitrary Order where
|
|||||||
<*> arbitrary -- orderStatus :: Maybe Text
|
<*> arbitrary -- orderStatus :: Maybe Text
|
||||||
<*> arbitrary -- orderComplete :: Maybe Bool
|
<*> arbitrary -- orderComplete :: Maybe Bool
|
||||||
|
|
||||||
instance Arbitrary OuterBoolean where
|
|
||||||
arbitrary =
|
|
||||||
OuterBoolean <$> arbitrary
|
|
||||||
instance Arbitrary OuterComposite where
|
instance Arbitrary OuterComposite where
|
||||||
arbitrary =
|
arbitrary =
|
||||||
OuterComposite
|
OuterComposite
|
||||||
<$> arbitrary -- outerCompositeMyNumber :: Maybe OuterNumber
|
<$> arbitrary -- outerCompositeMyNumber :: Maybe Double
|
||||||
<*> arbitrary -- outerCompositeMyString :: Maybe OuterString
|
<*> arbitrary -- outerCompositeMyString :: Maybe Text
|
||||||
<*> arbitrary -- outerCompositeMyBoolean :: Maybe OuterBoolean
|
<*> arbitrary -- outerCompositeMyBoolean :: Maybe Bool
|
||||||
|
|
||||||
instance Arbitrary OuterNumber where
|
|
||||||
arbitrary =
|
|
||||||
OuterNumber <$> arbitrary
|
|
||||||
instance Arbitrary OuterString where
|
|
||||||
arbitrary =
|
|
||||||
OuterString <$> arbitrary
|
|
||||||
instance Arbitrary Pet where
|
instance Arbitrary Pet where
|
||||||
arbitrary =
|
arbitrary =
|
||||||
Pet
|
Pet
|
||||||
|
@ -46,11 +46,8 @@ main =
|
|||||||
propMimeEq MimeJSON (Proxy :: Proxy Name)
|
propMimeEq MimeJSON (Proxy :: Proxy Name)
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy NumberOnly)
|
propMimeEq MimeJSON (Proxy :: Proxy NumberOnly)
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy Order)
|
propMimeEq MimeJSON (Proxy :: Proxy Order)
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy OuterBoolean)
|
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy OuterComposite)
|
propMimeEq MimeJSON (Proxy :: Proxy OuterComposite)
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy OuterEnum)
|
propMimeEq MimeJSON (Proxy :: Proxy OuterEnum)
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy OuterNumber)
|
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy OuterString)
|
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy Pet)
|
propMimeEq MimeJSON (Proxy :: Proxy Pet)
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy ReadOnlyFirst)
|
propMimeEq MimeJSON (Proxy :: Proxy ReadOnlyFirst)
|
||||||
propMimeEq MimeJSON (Proxy :: Proxy SpecialModelName)
|
propMimeEq MimeJSON (Proxy :: Proxy SpecialModelName)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user