-
Notifications
You must be signed in to change notification settings - Fork 60
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
[qod-api.yaml]: IPv6-object will be generated instead of a String #84
Comments
Hi @maxl2287 This "allOf" type of construct for patterns originates from 3GPP (see TS 29.571). Although not currently used by the T8 for IPv6 addresses (that accepts any string), it can be expected that format restrictions imposed by the combined patterns will be enforced by 3GPP service based interfaces, and eventually by the T8 itself (which is long overdue an update). The pattern was adopted so that we can avoid having to do additional parameter checking before passing IPv6 addresses onto the NEF (although, having said that, it was agreed to make a /128 mask optional, so really that should be added if the client has omitted it). I've no problem to replace the "allOf" construct with an equivalent single line pattern, but your proposed pattern does not achieve that. By concatenating the two patterns with an "OR", you are effectively replacing the "allOf" with an "anyOf" - not the same at all. So an alternative single line pattern needs to be proposed. More generally, being an open-source project, swagger-codegen will always fail for some otherwise valid OAS definitions as the number of active developers is limited. I'm reluctant to be restricted (in general) by the capabilities of tooling if that limits or obscures what would otherwise be a clear definition that is anyway meant to be read by the developer. And the intention of the 3GPP pattern construct is very clear, even if the tooling cannot compile it. Internally within Vodafone, we also encountered this problem, but simply replaced the combined IPv6 patterns with a less restrictive one. So the restrictions on IPv6 formatting remains clear to the client (i.e. use IETF 5952 compliant formatting), even if we are not actually properly enforcing that at the moment. |
Hi @maxl2287 @eric-murray , We have also experienced disagreements with openapi-generator. My 2 cents |
Hi, We have also received feedback due to problems parsing this allOf with 2 pattterns, so I think we should convert it to a single line pattern. |
so what do to with this issue? Ipv6Addr:
type: string
format: ipv6
pattern: '(^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))?$)|(^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)?$)'
example: "2001:db8:85a3:8d3:1319:8a2e:370:7344"
description: |
IPv6 address, following IETF 5952 format, may be specified in form <address/mask> as:
- address - The /128 subnet is optional for single addresses:
- 2001:db8:85a3:8d3:1319:8a2e:370:7344
- 2001:db8:85a3:8d3:1319:8a2e:370:7344/128
- address/mask - an IP v6 number with a mask:
- 2001:db8:85a3:8d3::0/64
- 2001:db8:85a3:8d3::/64 |
Hi @maxl2287 As I mentioned previously, an OR ( How about just the first part of the 3GPP pattern (with optional subnet)? I don't know what additional constraints the second part adds, and don't have time to run tests, but maybe it can be dropped. |
Another option would be to avoid providing a pattern, if we are not sure of using the correct one, and rely on Indeed we are already using |
@jlurien My personal preference is for IETF 5952, as we can be fairly sure that 3GPP network elements (such as the NEF) will accept this. The risk of relying solely on The value of specifying a pattern is that each implementation should accept and reject the same formats. |
The format 'ipv6' does not allow an netmask. |
That's addressed within #153. Beyond that the issue is staled and will be closed as discussed. |
Problem
With the current definition of having two patterns in the "allOf"-definition of IPv6, the code-generator will generate a senseless Object of IPv6Addr, which cannot be used and which does not have anything relevant inside.
Means that IPv6 cannot be used as an input-variable at all.
QualityOnDemand/code/API_definitions/qod-api.yaml
Line 398 in 5e9d512
Suggested fix
Remove the allOf and just use one pattern which is the combination of both patterns.
The text was updated successfully, but these errors were encountered: