guardrail-dev / guardrail-dev/guardrail
Unify identical objects
- Dominant language
- Scala
- Stars
- 541
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Description
Currently, identical classes are completely incompatible, even if generated from the same OpenAPI specification file. This is due to different JVM package paths being chosen for generated classes, and can be worked around by having identical definitions generated with the same package and name.
This is not scalable, as generating clients and servers in different scopes (`compile` vs `test:compile`, for instance) would be very fragile, if it worked at all.
A better solution would be to keep track of all generated classes (this would additionally help to avoid name conflicts between different OpenAPI specification files), hashing structures to determine if they are identical, then only emitting one (with type aliases or some other technique to maintain the API of the deduplicated classes).
Something else to consider would be conversions between different types, if they are close enough (optional parameters vs required parameters, for instance, would permit going one direction but not necessarily the other direction).
Contributor guide
Assessment
This issue has not been assessed yet.