GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — @include in graphql-schema not working · Issue #343 · comigor/artemis

This repository was archived by the owner on Oct 2, 2024. It is now read-only.
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

@include in graphql-schema not working #343

Copy link
Copy link
Open
Open
@include in graphql-schema not working#343
Copy link
Labels
bugSomething isn't working

Description

@Nealsoni00
Nealsoni00
opened on Jul 16, 2021
Issue body actions

Bug description

I have an @include (if: $detailed) in my fragment. When that $detailed is set to false, and the schema is returned without the property, parsing the response with the generated type file does not work.

The fragment is included using fragment_glob in build.yml

image

fragment propertyFields on Property {
    id
    optionallyIncludedProperty(first: $number, after: $cursor) @include(if: $detailed) {
        ...someConnectionFields
    }
}

line that errors:

SomeMixin$Property _$SomeMixin$PropertyFromJson(
    Map<String, dynamic> json) {
  return SomeMixin$Property()
    ..id = json['id'] as String
    ..optionallyIncludedProperty = SomeMixin$SomeConnection.fromJson(
        json['optionallyIncludedProperty'] as Map<String, dynamic>) \\<----
}

Specs

artemis: ^7.0.0-beta.3

build.yaml:
targets:
  $default:
    sources:
      - lib/**
    builders:
      artemis:
        options:
          fragments_glob: lib/graphql/operations/fragments/*.graphql
          schema_mapping:
            - schema: lib/graphql/schema.graphql
              queries_glob: lib/graphql/operations/api.graphql
              output: lib/graphql/api.dart
          scalar_mapping:
            - graphql_type: JSON
              dart_type: Map<String, dynamic>
            - graphql_type: ISO8601DateTime
              dart_type: DateTime
Artemis output:
builds successfully

Activity

  1. Nealsoni00
    added
    bugSomething isn't working
    on Jul 16, 2021
  2. kmcgill88 commented on Jul 21, 2022

    @kmcgill88
    kmcgill88
    on Jul 21, 2022
    More actions

    I ran into the same issue with artemis: 7.8.0-beta. In my case the graph query executes correctly but conditionally some data isn't return,...hence the parsing error. Same thing for @skip.

  3. cfsbhawkins commented on Oct 6, 2022

    @cfsbhawkins
    cfsbhawkins
    on Oct 6, 2022
    More actions

    Yeah this seems to be related to the model builder, @include will work just fine if the Schema says field could be nullable, but if it's something that reports back as not nullable then includes will fail, such as a connection or node.

  4. sarp86 commented on Nov 18, 2022

    @sarp86
    sarp86
    on Nov 18, 2022
    More actions

    Any updates? We have the same problem? This ticket is open over one year?

  5. pdegand commented on Mar 15, 2023

    @pdegand
    pdegand
    on Mar 15, 2023
    More actions

    @comigor As a solution for this issue, could this be an acceptable behavior to generate a Dart nullable field if a non-nullable GraphQL field marked with the @include directive ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.