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

DEVDOCS-5007: [update] add redirect feature #798

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

Conversation

bc-traciporter
Copy link
Collaborator

@bc-traciporter bc-traciporter commented Feb 3, 2025

DEVDOCS-5007

What changed?

Added Redirect example under Get a Product.

Release notes draft

Redirect parameter on the route node.

Anything else?

ping {names}

@bc-traciporter bc-traciporter added the need-SME-review A subject matter expert is needed to review. label Feb 3, 2025
@bc-traciporter bc-traciporter requested review from zvuki and bc-jz February 3, 2025 21:03
@@ -87,6 +87,27 @@ Query all products by not including an argument for `products`.

You can also query for featured products, related products, and more. See the [GraphQL Storefront Playground](https://developer.bigcommerce.com/graphql-storefront/playground) for full schema documentation.

### Get a product by URL using a route node

Query a list of products by matching the `Redirect` type.
Copy link

Choose a reason for hiding this comment

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

You can only query a single resource (product in this case) at a time with the route node.

query {
site {
route(path: "/laura-ashley-duck-egg-paint/113699-master/", redirect: [FOLLOW|IGNORE] = IGNORE) {
redirect # <--- new redirect node of a type Redirect
Copy link

Choose a reason for hiding this comment

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

It does not seem relevant to include the redirect node in this response since the example is specific to getting a product. If you do include it though then it should be mentioned that redirect will only exist if the path supplied as input points at a redirection. Otherwise it will be null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bc-jz I am a little confused about this ticket. I am confused whether we should document the LookUpUrl capability, the redirect node, or the route and node nodes. The title of the ticket says LookUpUrl to account for redirects. The GraphQL example in the ticket has a redirect node. Is this example querying a product or a redirect? Do we need a different example? Do we need two queries, one to query the redirect and then a second one to query a product. I really don't know how this works from just reading the tickets and looking at this example.

Comment on lines +100 to +105
node {
id
... on Product {
name
}
}
Copy link

Choose a reason for hiding this comment

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

I think we should give some description about the node behavior here and its relation to the redirect input parameter on the route.

If the redirect input param is set to IGNORE then the node response here can be null if the supplied path does not match with any existing product (or resource).

If the redirect input param is set to FOLLOW then the product node content will be returned even if the path input that is supplied points as a redirect that points at a product.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bc-jz Do we need the routes.mdx file?

Copy link

Choose a reason for hiding this comment

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

@bc-jz Do we need the routes.mdx file?

I think having a specific routes.mdx would be good as it would allow describing the route node with depth that does not really apply to the example in this section.

I'm thinking about organization of this information and trying to avoid making these examples overly complex by getting into details that are a bit beyond the needs of explaining how to "get a product by a url".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-SME-review A subject matter expert is needed to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants