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

AnyOf generate weird root model and incorrect any model #1209

Closed
jonaslagoni opened this issue Apr 2, 2023 · 1 comment
Closed

AnyOf generate weird root model and incorrect any model #1209

jonaslagoni opened this issue Apr 2, 2023 · 1 comment
Labels
bug Something isn't working stale

Comments

@jonaslagoni
Copy link
Member

jonaslagoni commented Apr 2, 2023

Describe the bug

Relevant for both next and master, after #1208 I tried with anyOf instead, and it generate even weirder results... I expect the same as I explained in #1208.

What is now generated is really weird version of the Action model, as it contains

import {AnyOf_0} from './AnyOf_0';
type Action = AnyOf_0;
export { Action };

When it should be a whole model in itself.

AnyOf_0 contains:

import {PackageAction} from './PackageAction';
class AnyOf_0 {
  private _config?: PackageAction;
  ....
}
export { AnyOf_0 };

Which should have been the Action model 🤨 And is missing type and additionalProperties properties 🤔

PackageAction is actually generated correctly:


class PackageAction {
  private _script?: string;
  private _additionalProperties?: Map<string, any>;
  ....
}
export { PackageAction };

Schema:

{
  "type": "object",
  "title": "Action",
  "properties": {
      "type": {
          "type": "string",
          "description": "The type of action for automator to run, when a new version has been found",
          "enum": [
              "package"
          ]
      },
      "config": true
  },
  "anyOf": [
      {
          "if": {
              "properties": {
                  "type": {
                      "const": "package"
                  }
              }
          },
          "then": {
              "properties": {
                  "config": {
                      "$ref": "#/definitions/PackageAction"
                  }
              }
          }
      }
  ],
  "definitions": {
      "PackageAction": {
          "type": "object",
          "properties": {
              "script": {
                  "type": "string",
                  "description": "The script to run in the package file"
              }
          }
      }
  }
}
@jonaslagoni jonaslagoni added the bug Something isn't working label Apr 2, 2023
@jonaslagoni jonaslagoni changed the title AnyOf generate weird root model AnyOf generate weird root model and incorrect any model Apr 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Aug 1, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

1 participant