dotansimha / dotansimha/graphql-code-generator

Non-breaking spaces in documentation are kept with codegen

Open
#6,981 0 comments 0 reactions 0 assignees View on GitHub
core
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

**Describe the bug**
If there are any non-breaking spaces in GraphQL documentation (char code 160), they are left intact in the generated documentation. This is not a huge issue per se, but eslint does not like it and it's probably right.

**To Reproduce**
Steps to reproduce the behavior:

1. My GraphQL schema:

```graphql
"""
This is a test with a non breaking space.
"""
type Query {
user(id: ID!): User!
}

type User {
id: ID!
username: String!
email: String!
}
```

2. My GraphQL operations:

```graphql
query user {
user(id: 1) {
id
username
email
}
}
```

3. My `codegen.yml` config file:

```yml
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
plugins:
- typescript
- typescript-operations
```

**Expected behavior**
Non-breaking spaces should be replaced with _normal_ spaces.

**Additional context**
I will be happy to create a PR to change the current behavior, but I am not sure about a couple of points.
First of all, is it conceptually correct to _change_ the documentation? Probably we can all agree that things like non-breaking changes should not be used inside documentation, but that's also true for many, many other things (i.e.: `U+202e`). Should we exceptionally handle and transform non breaking spaces?
The second point is related to semver: something like this should be considered breaking, minor or fix? Transforming documentation will not _strictly break_ any code, but on the other hand it exposes users to possibly unexpected changes. What do you think?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.