Skip to content

config rules do not match TypeScript types for requiring schema property #1031

@asakusuma

Description

@asakusuma

Describe the bug

The JSON config rules for the schema technically do not require the schema field: https://github.com/kamilkisiela/graphql-config/blob/master/src/project-config.ts#L21

This is technically a legal config:

{
  "schemaPath":"foo",
  "projects":{
    "myproject": {
      "documents":["foo"]
    }
  }
}

But the types assume that every project has a defined schema field:
https://github.com/kamilkisiela/graphql-config/blob/master/src/types.ts#L53

I also don't think the JS API also has no way of accessing the schemaPath field. As their is no default project here AND project.getSchemaSync() doesn't work here.

To Reproduce
Steps to reproduce the behavior:

https://www.jsonschemavalidator.net/s/fbNGYrz8

I would not expect this config to be valid based on the typescript types

Environment:

  • OS:
  • GraphQL Config Version:
  • NodeJS:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions