-
Notifications
You must be signed in to change notification settings - Fork 26
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
adding feature to generate categories and disable the generation of the schema category and homepage #358
adding feature to generate categories and disable the generation of the schema category and homepage #358
Conversation
…Each in utils.js for the setUpCategorizationInfo function
Thank you, @coder2034, for submitting this new feature. I will do a deep review later in the week. But, I have a first quick feedback:
|
…n homepageLocation is set to false
Hey Edno!
Please let me know of any improvements I can make! Thank you! |
…nto two more function: getCategory and convertArrayToObject
@coder2034 - I like the overall feature, and the way you choose to leave the directive open. It will definitively be part of the package. I did a first code review, with some recommendations. |
…s;added configurable property for fallback category;removed use of lodash;
Thank you for the feedback! I've made some updates and added some comments. Please let me know what you think and if there is anything that I can make better. |
Thank you for your patience. The codebase of the v1 is not always easy to understand. And, so far, you did a good job 💪 The comments are more structural this time, but we are getting closer to get this feature merged. |
Let me know if you face issues with resolving conflicts while merging |
…t to the Renderer and Printer class
…tructure without grouping
…tructure with grouping
Hey Edno! I've made the following changes:
I also updated snapshots for the integration tests in generator.spec.js. After adding the code which prevents empty folders from being written, the test failed so I updated it to reflect the current codebase. The folder representing Unions was not being generated anymore because it was not specified in tweet.graphql but it was still being referenced in the old snapshot. From my understanding, this is the new intended behavior. |
2 comments but overall the PR is ready. Regarding the Note that the failing smoke test is due to the fact that the readme file is used for rendering the pages. For this PR, I will ignore this failure, and I will fix it in a separate PR. Great work on this feature, this is the biggest contribution on this project so far 👏 |
CodeSee Review Map:Review in an interactive map View more CodeSee Maps Legend |
Thank you for all your feedback and help throughout this process! I appreciate it! |
@coder2034 - You should be able to push those changes in the current branch (this PR), then I will trigger the merge. |
… parse category information static
Kudos, SonarCloud Quality Gate passed!
|
I've made the changes and made the method to parse the category information into a static method and also renamed grouping-info.js to group-info.js. |
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.
Merging this PR.
The feature will be released in 1.6.0 early next week.
Thank you @coder2034 for this contribution.
Thanks Edno! |
Motivation:
This PR contains two changes. One is to add categorization to provide for a better developer experience. For a large graphql schema, the list for graphql types can become overwhelming and having categories will make it easier for developers to find the information they want. Currently, graphql-markdown breaks documentation into mutations, interfaces, enums, etc. This proposed change will allow us to separate those types into specified categories. For example, if we were running an education management company, we could have categories like Grades, Courses, and Registration Information. Within those categories, we would have mutations, interfaces, enums, etc instead of all the types being in one list.
Change 1:
To accomplish the categorization, we would add a directive to a certain type and specify the category. For example, if I want a query to be placed under the Courses category, we can add
@doc(category: ‘Courses’)
. We would need to define the doc directive which I've outlined below. The directive name could be anything the developer wants.directive @doc(category: String!) on ENUM | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION | FIELD_DEFINITION
To enable this feature, the developer just has to specify the values for groupByDirective and fieldInDirective in docusaurus.config.js or as cli options. For the above example, groupByDirective would be doc and fieldInDirective would be category.
Change 2:
It would be great if there was a way to disable the automatic generating of the Schema category and the default landing page: generated.md. I added an option for developers to specify a value of false for baseURL and homepagelocationLocation which will not generate the Schema category and the homepage.