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
fix: fallback to template filename if sanitized name is empty #2808
fix: fallback to template filename if sanitized name is empty #2808
Conversation
@mecaota thanks for the PR! Will review shortly |
@mecaota so if we change the Types that are registered, we also need to change how the Template resolves here: https://github.com/wp-graphql/wp-graphql/blob/develop/src/Model/Post.php#L580-L584 We need to make sure we add some tests around this too. If you're not comfortable writing tests, it would be good to at least write detailed steps to reproduce the current issue + the behavior after the changes, then we can help get some tests written |
I think it would actually be nice if we could add support for something like a like: <?php
/**
* Template Name: My Templaté
* GraphQL Type Name: MyTemplate
*/ |
That sounds good! I agree with that solution. |
But, I am busy at the moment and it will be a while before I can fix.... |
@mecaota @jasonbahl a custom template header for |
@justlevine OK, I'll leave the corrections in this PR ready for merging. |
I'm sorry, I'm not familiar with PHP and I'm not familiar with writing integration tests, so I'd appreciate any advice. Here are the steps I would like to test: I think it will be some sort of test to check if the generated schema is correct. This is because the error currently mentioned in each issue comes from an invalid schema.
like this <?php
/*
Template Name: カスタムテンプレート
*/
?>
<section>
</section>
|
Yes, this PR recipe worked for me ( #2881 ). Many thanks, guys. |
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 is worked for me (#2881).
This is reproduce method→ #2808 (comment) CodeClimate has reported an issue, but this is not my implementation. Additionally, multiple similar issues have cropped up in the last few months since this PR was created, so it's clear that some people are in trouble. Please respond as soon as possible. |
62ceec1
to
e2bedfd
Compare
Rebased and linted to fix the phpcs issue |
Code Climate has analyzed commit d5c72b6 and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
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.
@jasonbahl I did a bit of cleanup, and then added the necessary tests in d5c72b6.
Should be good to merge once you review
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.
(changing status so I dont forget)
@jasonbahl I made the requested changes, this should be good to go 🤞 |
Well, the issue is definitely fixed for WordPress site using the GraphiQL IDE, but when working with the integration using various GraphQL clients(in my case, graphql-codegen features), I still encounter issues when the site locale is in non-ASCII format. |
@imjlk can you open another issue with steps to reproduce? If there's still a bug with locales, we should track it and work toward a fix (or at least document it) I'd love to know more about what you're experiencing and how to reproduce consistently |
What does this implement/fix? Explain your changes.
When we use non-ascii characters in all of template name, non-ascii characters type generated.
This PR is fix the issue by using file name.
Does this close any currently open issues?
fixes #2807, fixes #2492
Any relevant logs, error output, GraphiQL screenshots, etc?
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)
Any other comments?
…
Where has this been tested?
Operating System: docker
WordPress Version: 6.2