Skip to content

[Dart] Compilation errors for GITHUB.COM api #7821

Closed

Description

Found as part of #7774:

Using the Kiota source code from 2026-06-17 and these commands:

./it/generate-code.ps1 -descriptionUrl https://raw.githubusercontent.com/github/rest-api-description/refs/heads/main/descriptions/api.github.com/api.github.com.json -language dart -dev
.\it\exec-cmd.ps1 -descriptionUrl https://raw.githubusercontent.com/github/rest-api-description/refs/heads/main/descriptions/api.github.com/api.github.com.json -language dart

The generated client does not compile:

Analyzing lib...

  error • models\code_scanning_variant_analysis.dart:40:5 • Undefined class 'CodeScanningVariantAnalysis_status'. Try
          changing the name to the name of an existing class, or creating a class with the name
          'CodeScanningVariantAnalysis_status'. • undefined_class
  error • models\code_scanning_variant_analysis.dart:66:74 • The name 'CodeScanningVariantAnalysis_status' isn't a type,
          so it can't be used as a type argument. Try correcting the name to an existing type, or defining a type named
          'CodeScanningVariantAnalysis_status'. • non_type_as_type_argument
  error • models\code_scanning_variant_analysis.dart:66:127 • Undefined name 'CodeScanningVariantAnalysis_status'. Try
          correcting the name to one that is defined, or defining the name. • undefined_identifier
  error • models\code_scanning_variant_analysis.dart:85:31 • The name 'CodeScanningVariantAnalysis_status' isn't a type,
          so it can't be used as a type argument. Try correcting the name to an existing type, or defining a type named
          'CodeScanningVariantAnalysis_status'. • non_type_as_type_argument
  error • models\code_scanning_variant_analysis.dart:85:95 • The getter 'value' isn't defined for the type 'Object'. Try
          importing the library that defines 'value', correcting the name to the name of an existing getter, or defining
          a getter or field named 'value'. • undefined_getter
  error • models\pull_request_webhook.dart:29:26 • Expected to find ';'. • expected_token
  error • models\pull_request_webhook.dart:29:31 • Expected an identifier. • missing_identifier
  error • models\pull_request_webhook.dart:29:31 • Unexpected text ';'. Try removing the text. • unexpected_token
  error • models\pull_request_webhook.dart:30:31 • Expected to find ';'. • expected_token
  error • models\pull_request_webhook.dart:30:36 • Expected an identifier. • missing_identifier
  error • models\pull_request_webhook.dart:30:36 • Unexpected text ';'. Try removing the text. • unexpected_token
  error • models\repository_ruleset.dart:21:5 • Undefined class 'RepositoryRuleset_conditions'. Try changing the name to
          the name of an existing class, or creating a class with the name 'RepositoryRuleset_conditions'. •
          undefined_class
  error • models\repository_ruleset.dart:59:84 • The name 'RepositoryRuleset_conditions' isn't a type, so it can't be
          used as a type argument. Try correcting the name to an existing type, or defining a type named
          'RepositoryRuleset_conditions'. • non_type_as_type_argument
  error • models\repository_ruleset.dart:59:114 • Undefined name 'RepositoryRuleset_conditions'. Try correcting the name
          to one that is defined, or defining the name. • undefined_identifier
  error • models\repository_ruleset.dart:79:33 • The name 'RepositoryRuleset_conditions' isn't a type, so it can't be
          used as a type argument. Try correcting the name to an existing type, or defining a type named
          'RepositoryRuleset_conditions'. • non_type_as_type_argument
  error • repos\item\item\contents\item\with_path_get_response.dart:6:8 • Target of URI doesn't exist:
          '../../../../../models/with_path.dart'. Try creating the file referenced by the URI, or try using a URI for a
          file that does exist. • uri_does_not_exist

Activity

  1. moved this to Needs Triage 🔍 in Kiotaon Jun 22, 2026
  2. WolfgangHG commented on Jun 22, 2026

    @WolfgangHG
    ContributorAuthor

    Errortype 1
    The error type "Undefined class" might be the same as #7807


    Errortype 2:
    This error

      error • models\code_scanning_variant_analysis.dart:85:95 • The getter 'value' isn't defined for the type 'Object'. Try
              importing the library that defines 'value', correcting the name to the name of an existing getter, or defining
              a getter or field named 'value'. • undefined_getter
    

    probably can be ignored. It happens in this line:

    void serialize(SerializationWriter writer) {
        ...
        writer.writeEnumValue<CodeScanningVariantAnalysis_status>('status', status, (e) => e?.value);
        ...
    }

    The type "CodeScanningVariantAnalysis_status" was not found before, see "errortype 1".


    Errortype 3
    This error and following errors...

     error • models\pull_request_webhook.dart:29:26 • Expected to find ';'. • expected_token
    

    ...happens here:

    /// Instantiates a new [PullRequestWebhook] and sets the default values.
    PullRequestWebhook() : super() {
        allowAutoMerge = false,
        deleteBranchOnMerge = false,
        useSquashPrTitleAsDefault = false;
    }

    The syntax to call the super constructor before field initialization seems to be invalid.

    It works if you move the super() call to the end of the initializers::

    /// Instantiates a new [PullRequestWebhook] and sets the default values.
    PullRequestWebhook() :  
        allowAutoMerge = false,
        deleteBranchOnMerge = false,
        useSquashPrTitleAsDefault = false,
        super();

    Sample found here: https://www.darttutorial.org/dart-tutorial/dart-super/


    Errortype 4
    Final error is:

      error • repos\item\item\contents\item\with_path_get_response.dart:6:8 • Target of URI doesn't exist:
              '../../../../../models/with_path.dart'. Try creating the file referenced by the URI, or try using a URI for a
              file that does exist. • uri_does_not_exist
    

    This sounds like a discriminator problem - see e.g. typescript error #7803 (comment)

    The import seems to be unncessary, after removing it, there is no compilation error in this file.

  3. baywet commented on Jun 26, 2026

    @baywet
    Member

    Maybe Ricardo Boss (@ricardoboss) will be interested in this.

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

    No labels
    No labels

    Type

    Projects

    • Status
      Done ✔️

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions