-
Notifications
You must be signed in to change notification settings - Fork 81
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
Key of an element should be exposed in the element #264
Comments
+1. I think this is an important improvement to the usability of these models. I like Kaizen's approach of calling this a |
Discussed in Sept 10 hangout. +1 to this proposal. Most places will still use |
Thank you for the transcript of the hangout. For me the feature only makes sense when we have immutable maps (#240), otherwise the map content can be manipulated, without updating the name inside the value. Example on With version |
Discussed in the hangout today. One approach is to override the methods that |
@arthurdm I'll work on this issue |
The problem is that in Lines 378 to 379 in 14590bc
With An other aspect that should be considered / ensured: if a |
@wojtczat: Nice to see your PR #290 merged. For consistency reason, as @arthurdm suggested the parameter In microprofile-open-api/api/src/main/java/org/eclipse/microprofile/openapi/models/Paths.java Lines 34 to 41 in 8c8c649
In Lines 38 to 49 in 8c8c649
@wojtczat: Do you want to work on this? More generally, I still think that this change belongs to But I am not really impacted by what happen for the |
funny, I was thinking about this the other day. =) In theory I guess it is a breaking change since someone's model implementation would not compile. Unless we put a default impl returning |
Yeah sure I'll work on that @jmini |
from a java API perspective, I think it is allowed to add a method. I think that breaking changes is from an API user perspective. We did a lot of method addition (all the methods that were renamed. For for For me the main issue with having this method in |
I think one of the things we missed is a So for now, make the user of the model responsible for setting that, since we cannot control what they can do with the inherited Thoughts? |
I do not think that this method necessary at API level.
What is the use-case for this setter? I think we should start by adding the getter as described in this issue. If there is a need for a getter we might add it as well, but right now I do not see the value compared to the complexity of implementation. There is still work to do to finish it:
And then extend the pattern we are discussing to other elements in other maps.
When I wrote this issue, I was more thinking that the user has nothing to set. He can access the value in order to not have to work with |
I was thinking from a vendor's implementation side: once a new PathItem is inserted into the Map I would like to set its path string field to match the |
I am pretty new to this API / vendor stuff, but isn't the API intended to be used by users of the lib? If some vendors need a setter they can add it, but it should not be exposed at API level to the user. |
yup, it is indeed user-centric. But, if there are things we can do to make it easier to implement the spec (for a vendor), so that they don't have to cast into impls, then that would be good too. I am ok either way with this - just wanted to bring up that vendors will have to cast (i.e. |
In consideration of the upcoming MicroProfile OpenAPI 1.1 release scheduled for mid Dec (see #296), I think that the feature is not yet ready to be included in Action: |
that sounds ok with me. @jmini - if you wanted to do the revert, I am fine with this only going into 2.0. |
We discussed this issue in today's meeting and the current thinking is that having adding this functionality may limit the re-usability of the value models and also introduce some challenges with keeping the things in sync. @jmini, is this something you still have an interest in pursuing/discussing further? |
…lrye.config-smallrye-config-1.6.2 Bump smallrye-config from 1.6.1 to 1.6.2
Originally posted as
Question 2
in #234When you work a lot with the model classes, for each member of a map (like
PathItem
element in thePaths
object), you need to transport the key and the value everywhere because the information you need in contained inEntry<String, PathItem>
.Example:
Or to have your own holder class:
The Kaizen-Parser Model did solve this with:
(source)
Maybe the wording is not ideal, @arthurdm pointed that the API needs to be consistent. PathItems are added with
addPathItem(String, PathItem)
:microprofile-open-api/api/src/main/java/org/eclipse/microprofile/openapi/models/Paths.java
Lines 34 to 41 in 8e0f247
So the getter for the key in the owner map in
PathItem
should be calledgetName()
.This issue needs further discussion and checks.
Other requirement having switched to immutable maps (see #240).
Then we can add also TCK tests that ensure that when you mutate a map the exposed key is also updated.
The text was updated successfully, but these errors were encountered: