-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Support multiple doc strings types with same content type (#2343) #2421
[Core] Support multiple doc strings types with same content type (#2343) #2421
Conversation
We're planning for deprecation but the project hasn't been deprecated yet - due to a lack of replacement. Until it is removed |
Got it, will investigate that method and see if I manage to make it return the actual GenericReturnType of DocStringType lambdas. |
9aa111a
to
3fd8a35
Compare
Fixed the "type erasure" issue, all test pass, I'm able to do a "clean install" at the project level. |
…ttps://github.com/PostelnicuGeorge/cucumber-jvm into PostelnicuGeorge-feature/PG-2343_support_different_doc_string_types
- Replaces the use of `Objects.isNull` with regular null checks. - Removes the use of `Optional` and entangled methods by making lookup return a list
02d2ffa
to
b27d69d
Compare
…rt_different_doc_string_types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heya, looks really good!
I've pushed some changes to resolve some of nitpicks I had with the DocStringTypeRegistry
and DocStringTypeRegistryDocStringConverter
. By making docStringTypeRegistry.lookup
return a list it is possible to handle all error cases at once.
I've got some questions about the other changes.
java/src/test/java/io/cucumber/java/JavaDocStringTypeDefinitionTest.java
Outdated
Show resolved
Hide resolved
java/src/test/java/io/cucumber/java/JavaDocStringTypeDefinitionTest.java
Outdated
Show resolved
Hide resolved
docstring/src/test/java/io/cucumber/docstring/DocStringTest.java
Outdated
Show resolved
Hide resolved
docstring/src/test/java/io/cucumber/docstring/DocStringTypeRegistryDocStringConverterTest.java
Outdated
Show resolved
Hide resolved
docstring/src/test/java/io/cucumber/docstring/DocStringTypeRegistryDocStringConverterTest.java
Outdated
Show resolved
Hide resolved
java8/src/test/java/io/cucumber/java8/TypeDefinitionsStepDefinitions.java
Outdated
Show resolved
Hide resolved
docstring/src/main/java/io/cucumber/docstring/DocStringType.java
Outdated
Show resolved
Hide resolved
docstring/src/main/java/io/cucumber/docstring/DocStringType.java
Outdated
Show resolved
Hide resolved
core/src/test/java/io/cucumber/core/stepexpression/StepExpressionFactoryTest.java
Show resolved
Hide resolved
Btw, don't worry about force pushing. The default is squash merge so we don't have to keep branches clean. |
Codecov Report
@@ Coverage Diff @@
## main #2421 +/- ##
============================================
+ Coverage 83.61% 83.66% +0.05%
- Complexity 2634 2646 +12
============================================
Files 317 317
Lines 9312 9331 +19
Branches 905 906 +1
============================================
+ Hits 7786 7807 +21
Misses 1191 1191
+ Partials 335 333 -2
Continue to review full report at Codecov.
|
I have added a test to check that if we use the same parameter type like List of Grocery in a step definition, we're able to use interchangeably that a DocString or DataTable can be used that convert to that particular type. Is there a better place to put this kind of test? |
I'd say that Now all that is left now is to add an example to the documentation to illustrate this usecase. https://github.com/cucumber/cucumber-jvm/tree/main/java#docstring-type I think one one example where two json doc strings are converted to different objects would be sufficient. |
I have added the example, is there something else remaining? What's the process now going further? |
I'll have to find the time to give it another review and then it will presumably be merged and released. All the issues tagged with |
…rt_different_doc_string_types
8f9f092
to
1bcc7b9
Compare
Is your pull request related to a problem? Please describe.
It's the implementation to: #2343
Describe the solution you have implemented
With this implementation is now possible to have DocStrings of default type ("") or a particular contentType like "application/json" to have multiple DocStringTypes (different return types). This gives leverage for users to take full advantage of Jackson ObjectMapper conversions.
Tests were implemented and updated to cover the new situations where it should be allowed to have multiple DocStringTypes per same contentType, this creates much more concise transformers but doesn't allow any more ambiguity around Object as a return type.