Key of an element should be exposed in the element
See original GitHub issueOriginally posted as Question 2
in https://github.com/eclipse/microprofile-open-api/issues/234
When you work a lot with the model classes, for each member of a map (like PathItem
element in the Paths
object), you need to transport the key and the value everywhere because the information you need in contained in Entry<String, PathItem>
.
Example:
void printOperationsInfo(String path, PathItem path);
Or to have your own holder class:
static class PathItemWithPath {
final String pathString;
final PathItem path;
public PathItemWithPath(final String pathString, final PathItem path) {
super();
this.pathString = pathString;
this.path = path;
}
The Kaizen-Parser Model did solve this with:
String getPathString();
(source)
Maybe the wording is not ideal, @arthurdm pointed that the API needs to be consistent. PathItems are added with addPathItem(String, PathItem)
:
So the getter for the key in the owner map in PathItem
should be called getName()
.
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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:18 (18 by maintainers)
Top GitHub Comments
that sounds ok with me. @jmini - if you wanted to do the revert, I am fine with this only going into 2.0.
@arthurdm I’ll work on this issue