Skip to content
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

Change format keyword positioning #664

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bhavukkalra
Copy link
Contributor

@bhavukkalra bhavukkalra commented Apr 18, 2024

What kind of change does this PR introduce?
PR moves the format section of the documentation from the misplaced string page to under the more generic type as discussed in Issue #759. Which aims to remove the Misinterpretation that the reader might get that format as a keyword is only for string types which is not the case.

Also, Add further clarification that format as a keyword is generic. Using these lines added further

image

Issue Number:

Screenshots

  • Added section under type page

image

  • removed from format section from string page

image

Summary
PR aims to re-adjust the positioning of format keyword definitions. To remove any confusion of it being a string specific keyword as reported by the users here Slack Archives

Does this PR introduce a breaking change?
No

CC - @benjagm @gregsdennis @jviotti

…arirification added on the usage of format keyword
@bhavukkalra bhavukkalra requested a review from a team as a code owner April 18, 2024 12:13
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to the JSON Schema Community. Thanks a lot for creating your first pull request!! 🎉🎉 We are so excited you are here! We hope this is only the first of many! For more details check out README.md file.

@bhavukkalra bhavukkalra changed the title Change format positioning to be under type instead of string, More cl… Change format keyword positioning Apr 18, 2024
@benjagm
Copy link
Collaborator

benjagm commented Apr 23, 2024

misplaced string page to under the more generic type as discussed in json-schema-org/json-schema-spec#759

I checked the issue json-schema-org/json-schema-spec#759 and it was closed 2019. Are you sure you are referring to the right issue?

@benjagm benjagm added the Status: In Progress This issue is being worked on, and has someone assigned. label Apr 23, 2024
Copy link
Collaborator

@benjagm benjagm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work Bhavuk, Thanks!!

to enable `format` to function as an assertion rather than just an
annotation. That means that validation will fail if, for example, a
value with a `date` format isn\'t in a form that can be parsed as a
date. This can allow values to be constrained beyond what the other

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:
This allows values to be constrained beyond what the other tools in JSON Schema can do, including Regular Expressions.


- `"date-time"`: Date and time together, for example,
`2018-11-13T20:20:39+00:00`.
- `"time"`: <StarInline label="New in draft 7" /> Time, for example, `20:20:39+00:00`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `"time"`: <StarInline label="New in draft 7" /> Time, for example, `20:20:39+00:00`
- `"time"`: <StarInline label="New in draft 7" /> Time, for example, `20:20:39+00:00`.


There is a bias toward networking-related formats in the JSON Schema
specification, most likely due to its heritage in web technologies.
However, custom formats may also be used, as long as the parties

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:
However, custom formats may also be used if the parties exchanging the JSON documents share information about the custom format types

## Format[#format]

The `format` keyword allows for basic semantic identification of certain
kinds of values that are commonly used. or user could define its own format and use them alongside

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kinds of values that are commonly used. or user could define its own format and use them alongside
kinds of commonly used, or a user could define their format and use them alongside

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammatically, this still seems incomplete.

As written:

The format keyword allows for basic semantic identification of certain
kinds of values that are commonly used. or user could define its own format and use them alongside

  • "... commonly used. or user could ..." - The second sentence seems to start in the middle of a thought.
  • "and use them alongside" - Alongside what? This needs an object.

As suggested:

The format keyword allows for basic semantic identification of certain kinds of commonly used, or a user could define their format and use them alongside

  • "certain kinds of commonly used..." - Commonly used what? Object needed.
  • "and use them alongside" - Alongside what? This needs an object.

My suggestion:

The format keyword conveys semantic information for values that may be difficult or impossible to describe using JSON Schema. Typically, this semantic information is described by other documents. The JSON Schema Validation specification defines a number of formats, however this keyword also allows schema authors to define their own formats.

@kakabisht
Copy link

Hello,
I followed the Microsoft style guide for technical writing to review the content.
My only concern is formatting the code snippets. If you are fixing the code snippet indentation here, It would help if you also fixed the indentation across the entire documentation.

benjagm and others added 3 commits May 21, 2024 10:20
Co-authored-by: hridyesh bisht <41201308+kakabisht@users.noreply.github.com>
Co-authored-by: hridyesh bisht <41201308+kakabisht@users.noreply.github.com>
Co-authored-by: hridyesh bisht <41201308+kakabisht@users.noreply.github.com>
Copy link
Member

@gregsdennis gregsdennis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bhavukkalra please address the outstanding comments. We can merge afterward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In Progress This issue is being worked on, and has someone assigned.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format is not only allowed for string values
4 participants