-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NPE with Haskell client generator with OAS3 spec (#334)
* fix NPE with haskell client oas3, better type check * better unknown type check
- Loading branch information
Showing
22 changed files
with
677 additions
and
729 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: \" \\ | ||
OpenAPI Version: 3.0.1 | ||
OpenAPI Version: 3.0.0 | ||
Swagger Petstore API version: 1.0.0 | ||
Contact: [email protected] | ||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
-} | ||
|
||
{-| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: \" \\ | ||
OpenAPI Version: 3.0.1 | ||
OpenAPI Version: 3.0.0 | ||
Swagger Petstore API version: 1.0.0 | ||
Contact: [email protected] | ||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
-} | ||
|
||
{-| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: \" \\ | ||
OpenAPI Version: 3.0.1 | ||
OpenAPI Version: 3.0.0 | ||
Swagger Petstore API version: 1.0.0 | ||
Contact: [email protected] | ||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
-} | ||
|
||
{-| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: \" \\ | ||
OpenAPI Version: 3.0.1 | ||
OpenAPI Version: 3.0.0 | ||
Swagger Petstore API version: 1.0.0 | ||
Contact: [email protected] | ||
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 | ||
-- | ||
fakeOuterBooleanSerialize | ||
:: (Consumes FakeOuterBooleanSerialize contentType) | ||
=> ContentType contentType -- ^ request content-type ('MimeType') | ||
-> Accept accept -- ^ request accept ('MimeType') | ||
-> SwaggerPetstoreRequest FakeOuterBooleanSerialize contentType OuterBoolean accept | ||
fakeOuterBooleanSerialize _ _ = | ||
:: (Consumes FakeOuterBooleanSerialize MimeJSON) | ||
=> Accept accept -- ^ request accept ('MimeType') | ||
-> SwaggerPetstoreRequest FakeOuterBooleanSerialize MimeJSON Bool accept | ||
fakeOuterBooleanSerialize _ = | ||
_mkRequest "POST" ["/fake/outer/boolean"] | ||
|
||
data FakeOuterBooleanSerialize | ||
|
||
-- | /Body Param/ "boolean_post_body" - Input boolean as post body | ||
instance HasBodyParam FakeOuterBooleanSerialize BooleanPostBody | ||
-- | /Body Param/ "body" - Input boolean as post body | ||
instance HasBodyParam FakeOuterBooleanSerialize BodyBool | ||
|
||
-- | @application/json@ | ||
instance Consumes FakeOuterBooleanSerialize MimeJSON | ||
|
||
-- | @*/*@ | ||
instance MimeType mtype => Produces FakeOuterBooleanSerialize mtype | ||
|
@@ -88,18 +90,20 @@ instance MimeType mtype => Produces FakeOuterBooleanSerialize mtype | |
-- Test serialization of object with outer number type | ||
-- | ||
fakeOuterCompositeSerialize | ||
:: (Consumes FakeOuterCompositeSerialize contentType) | ||
=> ContentType contentType -- ^ request content-type ('MimeType') | ||
-> Accept accept -- ^ request accept ('MimeType') | ||
-> SwaggerPetstoreRequest FakeOuterCompositeSerialize contentType OuterComposite accept | ||
fakeOuterCompositeSerialize _ _ = | ||
:: (Consumes FakeOuterCompositeSerialize MimeJSON) | ||
=> Accept accept -- ^ request accept ('MimeType') | ||
-> SwaggerPetstoreRequest FakeOuterCompositeSerialize MimeJSON OuterComposite accept | ||
fakeOuterCompositeSerialize _ = | ||
_mkRequest "POST" ["/fake/outer/composite"] | ||
|
||
data FakeOuterCompositeSerialize | ||
|
||
-- | /Body Param/ "OuterComposite" - Input composite as post body | ||
instance HasBodyParam FakeOuterCompositeSerialize OuterComposite | ||
|
||
-- | @application/json@ | ||
instance Consumes FakeOuterCompositeSerialize MimeJSON | ||
|
||
-- | @*/*@ | ||
instance MimeType mtype => Produces FakeOuterCompositeSerialize mtype | ||
|
||
|
@@ -111,18 +115,20 @@ instance MimeType mtype => Produces FakeOuterCompositeSerialize mtype | |
-- Test serialization of outer number types | ||
-- | ||
fakeOuterNumberSerialize | ||
:: (Consumes FakeOuterNumberSerialize contentType) | ||
=> ContentType contentType -- ^ request content-type ('MimeType') | ||
-> Accept accept -- ^ request accept ('MimeType') | ||
-> SwaggerPetstoreRequest FakeOuterNumberSerialize contentType OuterNumber accept | ||
fakeOuterNumberSerialize _ _ = | ||
:: (Consumes FakeOuterNumberSerialize MimeJSON) | ||
=> Accept accept -- ^ request accept ('MimeType') | ||
-> SwaggerPetstoreRequest FakeOuterNumberSerialize MimeJSON Double accept | ||
fakeOuterNumberSerialize _ = | ||
_mkRequest "POST" ["/fake/outer/number"] | ||
|
||
data FakeOuterNumberSerialize | ||
|
||
-- | /Body Param/ "body" - Input number as post body | ||
instance HasBodyParam FakeOuterNumberSerialize Body | ||
|
||
-- | @application/json@ | ||
instance Consumes FakeOuterNumberSerialize MimeJSON | ||
|
||
-- | @*/*@ | ||
instance MimeType mtype => Produces FakeOuterNumberSerialize mtype | ||
|
||
|
@@ -134,43 +140,22 @@ instance MimeType mtype => Produces FakeOuterNumberSerialize mtype | |
-- Test serialization of outer string types | ||
-- | ||
fakeOuterStringSerialize | ||
:: (Consumes FakeOuterStringSerialize contentType) | ||
=> ContentType contentType -- ^ request content-type ('MimeType') | ||
-> Accept accept -- ^ request accept ('MimeType') | ||
-> SwaggerPetstoreRequest FakeOuterStringSerialize contentType OuterString accept | ||
fakeOuterStringSerialize _ _ = | ||
:: (Consumes FakeOuterStringSerialize MimeJSON) | ||
=> Accept accept -- ^ request accept ('MimeType') | ||
-> SwaggerPetstoreRequest FakeOuterStringSerialize MimeJSON Text accept | ||
fakeOuterStringSerialize _ = | ||
_mkRequest "POST" ["/fake/outer/string"] | ||
|
||
data FakeOuterStringSerialize | ||
|
||
-- | /Body Param/ "body" - Input string as post body | ||
instance HasBodyParam FakeOuterStringSerialize BodyText | ||
|
||
-- | @*/*@ | ||
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 Consumes FakeOuterStringSerialize MimeJSON | ||
|
||
instance Produces TestBodyWithQueryParams MimeNoContent | ||
-- | @*/*@ | ||
instance MimeType mtype => Produces FakeOuterStringSerialize mtype | ||
|
||
|
||
-- *** testClientModel | ||
|
@@ -323,7 +308,7 @@ instance HasOptionalParam TestEnumParameters EnumHeaderString where | |
-- | /Optional Param/ "enum_query_string_array" - Query parameter enum test (string array) | ||
instance HasOptionalParam TestEnumParameters EnumQueryStringArray where | ||
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) | ||
instance HasOptionalParam TestEnumParameters EnumQueryString where | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: \" \\ | ||
OpenAPI Version: 3.0.1 | ||
OpenAPI Version: 3.0.0 | ||
Swagger Petstore API version: 1.0.0 | ||
Contact: [email protected] | ||
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
-} | ||
|
||
{-| | ||
|
Oops, something went wrong.