- 
                Notifications
    You must be signed in to change notification settings 
- Fork 45
feat: do not wrap string validations #162
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
          
     Merged
      
      
    
  
     Merged
                    Changes from 1 commit
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -349,8 +349,8 @@ exports[`HTML Output given anyOf combiner placed next to allOf given allOf mergi | |
| </div> | ||
| <div> | ||
| <span>Allowed values:</span> | ||
| <span>\\"admin\\"</span> | ||
| <span>\\"editor\\"</span> | ||
| <span>admin</span> | ||
| <span>editor</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -562,8 +562,8 @@ exports[`HTML Output given oneOf combiner placed next to allOf given allOf mergi | |
| </div> | ||
| <div> | ||
| <span>Allowed values:</span> | ||
| <span>\\"admin\\"</span> | ||
| <span>\\"editor\\"</span> | ||
| <span>admin</span> | ||
| <span>editor</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -1006,12 +1006,12 @@ exports[`HTML Output should match arrays/of-complex-objects.json 1`] = ` | |
| </div> | ||
| <div> | ||
| <span>Allowed value:</span> | ||
| <span>\\"Constant name\\"</span> | ||
| <span>Constant name</span> | ||
| </div> | ||
| <div> | ||
| <span>Example values:</span> | ||
| <span>\\"Example name\\"</span> | ||
| <span>\\"Different name\\"</span> | ||
| <span>Example name</span> | ||
| <span>Different name</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -1126,12 +1126,12 @@ exports[`HTML Output should match arrays/of-complex-objects.json 1`] = ` | |
| <div><span>>= 2 characters</span></div> | ||
| <div> | ||
| <span>Default value:</span> | ||
| <span>\\"[email protected]\\"</span> | ||
| <span>[email protected]</span> | ||
| </div> | ||
| <div> | ||
| <span>Example values:</span> | ||
| <span>\\"[email protected]\\"</span> | ||
| <span>\\"[email protected]\\"</span> | ||
| <span>[email protected]</span> | ||
| <span>[email protected]</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -2461,9 +2461,9 @@ exports[`HTML Output should match combiners/allOfs/with-type.json 1`] = ` | |
| </div> | ||
| <div> | ||
| <span>Allowed values:</span> | ||
| <span>\\"Cancel\\"</span> | ||
| <span>\\"Confirm\\"</span> | ||
| <span>\\"Update\\"</span> | ||
| <span>Cancel</span> | ||
| <span>Confirm</span> | ||
| <span>Update</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -2589,7 +2589,7 @@ exports[`HTML Output should match combiners/oneof-with-array-type.json 1`] = ` | |
| </div> | ||
| <div> | ||
| <span>Allowed value:</span> | ||
| <span>\\"test\\"</span> | ||
| <span>test</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -2644,7 +2644,7 @@ exports[`HTML Output should match combiners/oneof-within-array-item.json 1`] = ` | |
| </div> | ||
| <div> | ||
| <span>Allowed value:</span> | ||
| <span>\\"test\\"</span> | ||
| <span>test</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -2687,12 +2687,12 @@ exports[`HTML Output should match default-schema.json 1`] = ` | |
| </div> | ||
| <div> | ||
| <span>Allowed value:</span> | ||
| <span>\\"Constant name\\"</span> | ||
| <span>Constant name</span> | ||
| </div> | ||
| <div> | ||
| <span>Example values:</span> | ||
| <span>\\"Example name\\"</span> | ||
| <span>\\"Different name\\"</span> | ||
| <span>Example name</span> | ||
| <span>Different name</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -2807,12 +2807,12 @@ exports[`HTML Output should match default-schema.json 1`] = ` | |
| <div><span>>= 2 characters</span></div> | ||
| <div> | ||
| <span>Default value:</span> | ||
| <span>\\"[email protected]\\"</span> | ||
| <span>[email protected]</span> | ||
| </div> | ||
| <div> | ||
| <span>Example values:</span> | ||
| <span>\\"[email protected]\\"</span> | ||
| <span>\\"[email protected]\\"</span> | ||
| <span>[email protected]</span> | ||
| <span>[email protected]</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -3439,12 +3439,12 @@ exports[`HTML Output should match tickets.schema.json 1`] = ` | |
| </div> | ||
| <div> | ||
| <span>Allowed values:</span> | ||
| <span>\\"COMPLETED\\"</span> | ||
| <span>\\"ACTIVE\\"</span> | ||
| <span>COMPLETED</span> | ||
| <span>ACTIVE</span> | ||
| </div> | ||
| <div> | ||
| <span>Default value:</span> | ||
| <span>\\"ACTIVE\\"</span> | ||
| <span>ACTIVE</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | @@ -3529,10 +3529,10 @@ exports[`HTML Output should match tickets.schema.json 1`] = ` | |
| </div> | ||
| <div> | ||
| <span>Allowed values:</span> | ||
| <span>\\"HOMEPRINT\\"</span> | ||
| <span>\\"TICKETLESS\\"</span> | ||
| <span>\\"PRINT_AT_KIOSK\\"</span> | ||
| <span>\\"SECURE_PAPER\\"</span> | ||
| <span>HOMEPRINT</span> | ||
| <span>TICKETLESS</span> | ||
| <span>PRINT_AT_KIOSK</span> | ||
| <span>SECURE_PAPER</span> | ||
| </div> | ||
| </div> | ||
| <div></div> | ||
|  | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, and how will one recognize such an enum?
I don't think it's a good decision to remove quotes. These are strings, so let them be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't in such a case. That's why I added it in the first place.
@mnaumanali94 is it really needed to remove those quotes? We're losing a type then.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a terrible enum! If someone is mixing stringified numbers and numberified numbers in an enum, their API is beyond our help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it is, but it's just to show the example.
The below cases are valid tho:
If we render them the same way, how will one be able to tell the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@P0lip are enums the only potential problem? Or can you think about more examples where this change would cause confusion? 🤔
What if we made the enums an exception here? @mnaumanali94 is a strong proponent of that change. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on the scenario.
Consider the below:
{ "enum": ["0", 1, "2"] }or
{ "type": ["string", "number"], "enum": ["0", 1, "2"] }One won't be able to tell the difference once we apply the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Have you ever seen an enum like this though? 🤦🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should
In our docs, these values should appear as "asc", "desc" is what you're suggesting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first example is quite common actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking this is not a common use case. The concern is primarily folks thinking
""are part of the value which would be wrong. Lets get this in, and see if there's a reaction from our consumers. If so, we can use colours to denote string vs integer values.