Skip to content

URL Proposal #1

Closed
Closed
@leebyron

Description

@leebyron

Here's my pitch for how the built URLs could work:

Urls follow a /namespace/scalar/version hierarchy:

  • https://scalars.graphql.org/
    • Lists out all scalars plus a search box
  • https://scalars.graphql.org/namespace/
    • Lists out all scalars within a namespace.
    • Namespaces are required to be github usernames or orgs so we can render a link that replaces "scalars.graphql.org" with "github.com" and takes you somewhere useful.
  • https://scalars.graphql.org/namespace/scalar
    • Metadata about a scalar spec including usage numbers (if we can get those, cdn hits API?) and links to all published versions (similar to https://spec.graphql.org/ ?)
    • Note that the scalar name in a URL is non-normative. It does not affect the name of the scalar found in someone's schema.
  • https://scalars.graphql.org/namespace/scalar/vA.B.C
    • Loads a specific version of a scalar spec. This URL is immutable
  • https://scalars.graphql.org/namespace/scalar/vA
    • Loads latest version which matches vA.X.X (this could be a 302 redirect)
  • https://scalars.graphql.org/namespace/scalar/vA.B
    • Loads latest version which matches vA.B.X (this could be a 302 redirect)

Examples:

  • https://scalars.graphql.org/andimarek/datetime/v1.0.0
    • Andi's original datetime proposal
  • https://scalars.graphql.org/graphql/url/v2
    • A future official URL scalar type, second version, which include any latest prose edits

Semver rules:

  • Major (vA.X.X)
    • Any change which is not backwards compatible with previous scalar specs
    • Example: a serialization format has changed
  • Minor (vX.B.X)
    • Any behavioral change which is backwards compatible
    • Example: an input validation rule was made more lenient
  • Patch (vX.X.C)
    • Non-behavioral changes
    • Example: Copy edits or additional examples

Implementation:

  • Current version is added to the top of the scalar spec markdown file as front-matter
  • This is always in the form vA.B to avoid merge conflicts for every PR.
    • The webpage generator should pick the next highest digit to create a vA.B.C from any previous built page if the frontmatter version does not change in a merged PR.
  • Part of our template guidelines should include semver guidelines. PRs that include behavioral changes should be encouraged to update the version front-matter as part of their patch.

Example:

---
Name: DateTime
Version: v1.2
Authors: andimarek 
---

# DateTime

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions