Skip to content
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

Mappings with hyphens can't be parsed #74

Open
clintandrewhall opened this issue Oct 22, 2019 · 3 comments
Open

Mappings with hyphens can't be parsed #74

clintandrewhall opened this issue Oct 22, 2019 · 3 comments

Comments

@clintandrewhall
Copy link

If the ES mapping property name contains a hyphen, the service cannot start. Is there a workaround?

    "comment-author-type": {
      type: "text",
      fields: {
        keyword: {
          type: "keyword",
          ignore_above: 256
        }
      }
    },
"errors": [
    {
      "message": "Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"comment-author-type\" does not.",
      "stack": [
        "GraphQLError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"comment-author-type\" does not.",
        "    at isValidNameError (/Users/clint/Projects/chirp/node_modules/graphql/utilities/assertValidName.js:42:12)",
        "    at validateName (/Users/clint/Projects/chirp/node_modules/graphql/type/validate.js:199:53)",
        "    at validateInputFields (/Users/clint/Projects/chirp/node_modules/graphql/type/validate.js:439:5)",
        "    at validateTypes (/Users/clint/Projects/chirp/node_modules/graphql/type/validate.js:240:7)",
        "    at validateSchema (/Users/clint/Projects/chirp/node_modules/graphql/type/validate.js:54:3)",
        "    at /Users/clint/Projects/chirp/node_modules/express-graphql/index.js:97:66",
        "    at processTicksAndRejections (internal/process/task_queues.js:93:5)"
      ]
    },
@nodkz
Copy link
Member

nodkz commented Oct 25, 2019

For now there is no mapping firlds with hyphens to camelCase.

There are two ways:

  • change ES field name to camelCase
  • dig lib code and open pull request

@Zhouchuanwen
Copy link

same error
image

@nodkz
Copy link
Member

nodkz commented Aug 21, 2020

@Zhouchuanwen Nope, this package cannot translate numeric field names to graphql field names. And I don't know any workaround for that. Except you rename fields according to graphql field name convention. Or write your own resolver from scratch without graphql-compose-elasticsearch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants