-
Notifications
You must be signed in to change notification settings - Fork 34
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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. |
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.
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 |
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 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
.
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.
@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.
node { | ||
id | ||
... on Product { | ||
name | ||
} | ||
} |
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 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.
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.
@bc-jz Do we need the routes.mdx file?
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.
@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".
DEVDOCS-5007
What changed?
Added Redirect example under Get a Product.
Release notes draft
Redirect parameter on the
route
node.Anything else?
ping {names}