-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Better Presentation of Maximum and Minimum String Length #2630
Comments
It looks like the same to me #2631 |
Hi Alex,
Thanks for looking into this. I am the author of #2630<#2630> and #263<#2630>1.
The two aren't the same although they are related.
#2630<#2630> is that I don't like the presentation of string minimum and maximum lengths. I'm suggesting they be explicitly labeled.
#263<#2630>1 is for a odd situation. An optional string field, for example, should have a minimum length of zero, it is optional after all. However, if a field value is provided, it might have a new minimum length of five. Is there a way of marking that in Redocly rather than commenting it in the description?
…________________________________
From: Alex Varchuk ***@***.***>
Sent: Monday, December 30, 2024 9:07 AM
To: Redocly/redoc ***@***.***>
Cc: APIWriter ***@***.***>; Author ***@***.***>
Subject: Re: [Redocly/redoc] Better Presentation of Maximum and Minimum String Length (Issue #2630)
It looks like the same to me #2630<#2630>.
—
Reply to this email directly, view it on GitHub<#2630 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AETYT3LVSINXGJ6TGOYYQET2IFOUJAVCNFSM6AAAAABTH3ENFGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRVGU4TSNJZGA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Sorry I put the wrong link. Updated and added comment to that #2631 (comment). |
I think your interpretation of
# valid
test: null that is different than empty # invalid
test: "" the validation for string fields only activates when a string value is defined. empty or otherwise but not with the Based on the constraints you have # valid
test: null
# valid
test: letters
# invalid
test: ""
# invalid
test: five
# invalid
test: areallylongstring |
Thanks for responding. The point was about making the minimum and maximum values clearer. It had nothing to do with null.
I was suggesting they get presented like:
minLength: 5
maxLength: 1
And not like an array:
[5...10]
…________________________________
From: Jeremy Fiel ***@***.***>
Sent: Monday, February 10, 2025 12:59 PM
To: Redocly/redoc ***@***.***>
Cc: APIWriter ***@***.***>; Author ***@***.***>
Subject: Re: [Redocly/redoc] Better Presentation of Maximum and Minimum String Length (Issue #2630)
I think your interpretation of null is slightly different than what is defined in OpenAPI or JSON Schema. Optionality has nothing to do with the validation results other than when the required keyword is used.
null equates to a field with a null value
# valid
test: null
that is different than empty
# invalid
test: ""
the validation for string fields only activates when a string value is defined. empty or otherwise but not with the null value.
Based on the constraints you have [5, 10] and nullable: true
# valid
test: null
# valid
test: letters
# invalid
test: ""
# invalid
test: five
# invalid
test: areallylongstring
—
Reply to this email directly, view it on GitHub<#2630 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AETYT3MJUIIYG7KDRDVX6LT2PDZJVAVCNFSM6AAAAABTH3ENFGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBYHE3DEMJZGU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Describe the bug

I don't like the way minimum and maximum string lengths are presented. They are seen as an unlabeled array such a [5 .. 10]. It's not clear at one glance what the notation even refers to.
Expected behavior
A more precise presentation would be to label each one explicitly:
Minimum length: 0
Maximum length: 5
Minimal reproducible OpenAPI snippet(if possible)
The coding is good, just not the rendering.
Screenshots

Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: