Skip to content

[compiler] Include exceptions to schema #4695

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

Merged
merged 6 commits into from
Jun 27, 2025
Merged

Conversation

Anaethelion
Copy link
Contributor

Types only found in exceptions are not included in the final schema.json because the compiler has not "seen" them.

This fixes the NotFoundAliases exception present in indices.get_alias.

This adds the following to the output:

    {
      "kind": "interface",
      "name": {
        "name": "IndexAliases",
        "namespace": "indices.get_alias._types"
      },
      "properties": [
        {
          "name": "aliases",
          "required": true,
          "type": {
            "kind": "dictionary_of",
            "key": {
              "kind": "instance_of",
              "type": {
                "name": "string",
                "namespace": "_builtins"
              }
            },
            "singleKey": false,
            "value": {
              "kind": "instance_of",
              "type": {
                "name": "AliasDefinition",
                "namespace": "indices._types"
              }
            }
          }
        }
      ],
      "specLocation": "indices/get_alias/_types/response.ts#L24-L26"
    },
    {
      "kind": "interface",
      "attachedBehaviors": [
        "AdditionalProperties"
      ],
      "behaviors": [
        {
          "generics": [
            {
              "kind": "instance_of",
              "type": {
                "name": "string",
                "namespace": "_builtins"
              }
            },
            {
              "kind": "instance_of",
              "type": {
                "name": "IndexAliases",
                "namespace": "indices.get_alias._types"
              }
            }
          ],
          "type": {
            "name": "AdditionalProperties",
            "namespace": "_spec_utils"
          }
        }
      ],
      "name": {
        "name": "NotFoundAliases",
        "namespace": "indices.get_alias._types"
      },
      "properties": [
        {
          "name": "error",
          "required": true,
          "type": {
            "kind": "instance_of",
            "type": {
              "name": "string",
              "namespace": "_builtins"
            }
          }
        },
        {
          "name": "status",
          "required": true,
          "type": {
            "kind": "instance_of",
            "type": {
              "name": "number",
              "namespace": "_builtins"
            }
          }
        }
      ],
      "specLocation": "indices/get_alias/_types/response.ts#L28-L33"
    },

Copy link
Member

@flobernd flobernd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I like happy linters.

@@ -211,8 +211,10 @@ pub fn expand(model: IndexedModel, config: ExpandConfig) -> anyhow::Result<Index

expand_behaviors(&mut resp.behaviors, &mappings, model, ctx)?;
expand_body(&mut resp.body, &mappings, model, ctx)?;

// TODO: exceptions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅

Copy link
Contributor

@l-trotta l-trotta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@Anaethelion Anaethelion merged commit 1c2d7f3 into main Jun 27, 2025
10 checks passed
@Anaethelion Anaethelion deleted the include_exceptions_to_schema branch June 27, 2025 09:28
github-actions bot pushed a commit that referenced this pull request Jun 27, 2025
* compiler: validate types found only in exceptions

* split indices.get_alias for clarity, handle NotFoundAliases with previous comit

* making the compiler linter happy again

* align generics expansion between rust and typescript

* compiler: propagate generics in case someone want to have a generic exception

* once again, making the linter happy

(cherry picked from commit 1c2d7f3)
github-actions bot pushed a commit that referenced this pull request Jun 27, 2025
* compiler: validate types found only in exceptions

* split indices.get_alias for clarity, handle NotFoundAliases with previous comit

* making the compiler linter happy again

* align generics expansion between rust and typescript

* compiler: propagate generics in case someone want to have a generic exception

* once again, making the linter happy

(cherry picked from commit 1c2d7f3)
github-actions bot pushed a commit that referenced this pull request Jun 27, 2025
* compiler: validate types found only in exceptions

* split indices.get_alias for clarity, handle NotFoundAliases with previous comit

* making the compiler linter happy again

* align generics expansion between rust and typescript

* compiler: propagate generics in case someone want to have a generic exception

* once again, making the linter happy

(cherry picked from commit 1c2d7f3)
github-actions bot pushed a commit that referenced this pull request Jun 27, 2025
* compiler: validate types found only in exceptions

* split indices.get_alias for clarity, handle NotFoundAliases with previous comit

* making the compiler linter happy again

* align generics expansion between rust and typescript

* compiler: propagate generics in case someone want to have a generic exception

* once again, making the linter happy

(cherry picked from commit 1c2d7f3)
Anaethelion added a commit that referenced this pull request Jun 27, 2025
* compiler: validate types found only in exceptions

* split indices.get_alias for clarity, handle NotFoundAliases with previous comit

* making the compiler linter happy again

* align generics expansion between rust and typescript

* compiler: propagate generics in case someone want to have a generic exception

* once again, making the linter happy

(cherry picked from commit 1c2d7f3)

Co-authored-by: Laurent Saint-Félix <[email protected]>
Anaethelion added a commit that referenced this pull request Jun 27, 2025
* compiler: validate types found only in exceptions

* split indices.get_alias for clarity, handle NotFoundAliases with previous comit

* making the compiler linter happy again

* align generics expansion between rust and typescript

* compiler: propagate generics in case someone want to have a generic exception

* once again, making the linter happy

(cherry picked from commit 1c2d7f3)

Co-authored-by: Laurent Saint-Félix <[email protected]>
Anaethelion added a commit that referenced this pull request Jun 27, 2025
* compiler: validate types found only in exceptions

* split indices.get_alias for clarity, handle NotFoundAliases with previous comit

* making the compiler linter happy again

* align generics expansion between rust and typescript

* compiler: propagate generics in case someone want to have a generic exception

* once again, making the linter happy

(cherry picked from commit 1c2d7f3)

Co-authored-by: Laurent Saint-Félix <[email protected]>
Anaethelion added a commit that referenced this pull request Jun 27, 2025
* compiler: validate types found only in exceptions

* split indices.get_alias for clarity, handle NotFoundAliases with previous comit

* making the compiler linter happy again

* align generics expansion between rust and typescript

* compiler: propagate generics in case someone want to have a generic exception

* once again, making the linter happy

(cherry picked from commit 1c2d7f3)

Co-authored-by: Laurent Saint-Félix <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants