Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !2345

[haskell-http-client] compare rendered form in PropMime

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/guoshimin/propmime into master 6 years ago
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: guoshimin

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh, ./bin/security/{LANG}-petstore.sh and ./bin/openapi3/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

It is known that fromJson and toJson for Maybe are not the inverse of each other: https://github.com/bos/aeson/issues/376. It causes failures in the PropMime tests.

> encode (Just Null)
"null"
> encode (Nothing :: Maybe Value)
"null"
> > decode "null" :: Maybe Value
Just Null

Changing the PropMime tests to compared the rendered form instead.

@jonschoning, what do you think?

Compare
  • master (base)

and
  • latest version
    1d52230f
    1 commit, 2 years ago

2 files
+ 6
- 6

    Preferences

    File browser
    Compare changes
modules/openapi-gen‎erator/…/…/…/…/tests‎
PropMime‎.mustache‎ +3 -3
samples/clie‎nt/…/…/tests‎
PropM‎ime.hs‎ +3 -3
modules/openapi-generator/src/main/resources/haskell-http-client/tests/PropMime.mustache
+ 3
- 3
  • View file @ 1d52230f


@@ -32,14 +32,14 @@ type Arbitrary' a = (Arbitrary a, Show a, Typeable a)
propMime
:: forall a b mime.
(ArbitraryMime mime a, Testable b)
=> String -> (a -> a -> b) -> mime -> Proxy a -> Spec
=> String -> (BL8.ByteString -> BL8.ByteString -> b) -> mime -> Proxy a -> Spec
propMime eqDescr eq m _ =
prop
(show (typeOf (undefined :: a)) <> " " <> show (typeOf (undefined :: mime)) <> " roundtrip " <> eqDescr) $
\(x :: a) ->
let rendered = mimeRender' m x
actual = mimeUnrender' m rendered
expected = Right x
actual = fmap (mimeRender' m) (mimeUnrender' m rendered :: Either String a)
expected = Right rendered
failMsg =
"ACTUAL: " <> show actual <> "\nRENDERED: " <> BL8.unpack rendered
in counterexample failMsg $
samples/client/petstore/haskell-http-client/tests/PropMime.hs
+ 3
- 3
  • View file @ 1d52230f


@@ -32,14 +32,14 @@ type Arbitrary' a = (Arbitrary a, Show a, Typeable a)
propMime
:: forall a b mime.
(ArbitraryMime mime a, Testable b)
=> String -> (a -> a -> b) -> mime -> Proxy a -> Spec
=> String -> (BL8.ByteString -> BL8.ByteString -> b) -> mime -> Proxy a -> Spec
propMime eqDescr eq m _ =
prop
(show (typeOf (undefined :: a)) <> " " <> show (typeOf (undefined :: mime)) <> " roundtrip " <> eqDescr) $
\(x :: a) ->
let rendered = mimeRender' m x
actual = mimeUnrender' m rendered
expected = Right x
actual = fmap (mimeRender' m) (mimeUnrender' m rendered :: Either String a)
expected = Right rendered
failMsg =
"ACTUAL: " <> show actual <> "\nRENDERED: " <> BL8.unpack rendered
in counterexample failMsg $
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
3
Breaking change (without fallback) Enhancement: Compatibility Server: PHP
3
Breaking change (without fallback) Enhancement: Compatibility Server: PHP
    Assign labels
  • Manage project labels

Milestone
5.0.0
5.0.0 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!6346
Source branch: github/fork/guoshimin/propmime

Menu

Explore Projects Groups Snippets