-
Notifications
You must be signed in to change notification settings - Fork 43
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
Strange formatting of input types with descriptions #287
Comments
Example input: "A component contains the parametric details of a PCB part."
input DesComponentFilterInput {
and: [DesComponentFilterInput!]
or: [DesComponentFilterInput!]
"The library label for this component."
name: StringOperationFilterInput
"The additional information for this component."
comment: StringOperationFilterInput
"The summary of function or other performance details for this component."
description: StringOperationFilterInput
"The component revision."
revision: DesRevisionFilterInput
} Example result with unexpected new lines and indentations: "A component contains the parametric details of a PCB part."
input DesComponentFilterInput {
and: [DesComponentFilterInput!]
or: [DesComponentFilterInput!]
"The library label for this component."
name: StringOperationFilterInput
"The additional information for this component."
comment: StringOperationFilterInput
"The summary of function or other performance details for this component."
description: StringOperationFilterInput
"The component revision."
revision: DesRevisionFilterInput
} |
Indeed, I struggled with indentation (both horizontal and vertical) a lot when I rewrote the parser a long time ago. I will try to look at this problem today, but for now I am away from my home PC. |
OK. I reproduced this and I have an idea how to fix this. It requires some internal redesign of AST printing. |
@sungam3r Any progress? No pressure, just wondering when to expect the improvement, approximately. |
Nope. I can’t say when it will be ready. I remember this task. Recently I have been littered with household chores. |
I want to return to this task in the near future after I finish the adjacent changes in v8.2/v8.3. |
In process. There is some progress. I need to delicately tune practically each method of parser. |
@sungam3r Thank you for the good news, cannot wait to try it out! |
Fixed in #304 but I'm sure there are more issues to fix internally. |
@sungam3r Thank you! Will the nuget package be updated soon? |
Today or tomorrow. |
@sungam3r Thank you. There is a regression though (I think). Example before (normal indentation) type Query {
"Fetches an object given its ID."
node(
"ID of the object."
id: ID!): Node
"Lookup nodes by a list of IDs."
nodes(
"The list of node IDs."
ids: [ID!]!): [Node]!
"Search for workspaces associated with this account."
desWorkspaces(where: DesWorkspaceFilterInput): [DesWorkspace!]!
"Search a specific workspace by its unique identifier."
desWorkspaceById(
"The node identifier for a workspace."
id: ID!): DesWorkspace Example now (no indentation) type Query {
"Fetches an object given its ID."
node(
"ID of the object."
id: ID!): Node
"Lookup nodes by a list of IDs."
nodes(
"The list of node IDs."
ids: [ID!]!): [Node]!
"Search for workspaces associated with this account."
desWorkspaces(where: DesWorkspaceFilterInput): [DesWorkspace!]!
"Search a specific workspace by its unique identifier."
desWorkspaceById(
"The node identifier for a workspace."
id: ID!): DesWorkspace Should I submit another issue or this comment is enough for an action? |
Submit, please, in parser repo. |
With new design of indentation it should not take much time to fix. |
Here is the new issue -- #311 |
If an input type has field descriptions then formatting produces unexpected extra new lines and extra indentation of fields.
Please find attached the project for reproducing the issue.
TryGraphQLParser.zip
Test1
No issues for
type
types:x1-type.graphql
contains atype
with fields with descriptions.x1-type.graphql.output.graphql
is formatted as expected.Test2
Formatting issues with
input
with descriptions:x2-input.graphql
contains aninput
with fields with descriptions.x2-input.graphql.output.graphql
shows unexpected new lines and extra indentations.Test3
No issues with
input
without descriptions:x3-input.graphql
contains aninput
with no descriptions.x3-input.graphql.output.graphql
is formatted as expected.The text was updated successfully, but these errors were encountered: