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

fix: Let UI use maven generated YAML DSL sub schema #148

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

igarashitm
Copy link
Contributor

Fixes: #147

ATM sub schemas are not used by UI. We'll soon use for Beans editor (#8) and will be easier to identify the sub schema by its name being same as the property name - for example, beans to be a name for the beans sub schema. The old verbose name were moved as description in the index.json. We might want to generate an enum of these sub schema names and put in .d.ts.

@igarashitm igarashitm requested a review from a team September 22, 2023 20:12
@igarashitm
Copy link
Contributor Author

igarashitm commented Sep 22, 2023

Generated index.json

{
  "catalogs" : {
    "models" : {
      "name" : "models",
      "description" : "Aggregated Camel catalog for models",
      "version" : "4.1.0-SNAPSHOT",
      "file" : "camel-catalog-aggregate-models-4.1.0-SNAPSHOT.json"
    },
    "components" : {
      "name" : "components",
      "description" : "Aggregated Camel catalog for components",
      "version" : "4.1.0-SNAPSHOT",
      "file" : "camel-catalog-aggregate-components-4.1.0-SNAPSHOT.json"
    },
    "languages" : {
      "name" : "languages",
      "description" : "Aggregated Camel catalog for languages",
      "version" : "4.1.0-SNAPSHOT",
      "file" : "camel-catalog-aggregate-languages-4.1.0-SNAPSHOT.json"
    },
    "kamelets" : {
      "name" : "kamelets",
      "description" : "Aggregated Kamelet definitions in JSON",
      "version" : "4.0.0",
      "file" : "kamelets-aggregate-4.0.0.json"
    },
    "dataformats" : {
      "name" : "dataformats",
      "description" : "Aggregated Camel catalog for dataformats",
      "version" : "4.1.0-SNAPSHOT",
      "file" : "camel-catalog-aggregate-dataformats-4.1.0-SNAPSHOT.json"
    }
  },
  "schemas" : [ {
    "name" : "camelYamlDsl",
    "description" : "Camel YAML DSL JSON schema",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "beans",
    "description" : "Camel YAML DSL JSON schema: beans",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-beans-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "errorHandler",
    "description" : "Camel YAML DSL JSON schema: errorHandler",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-errorHandler-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "from",
    "description" : "Camel YAML DSL JSON schema: from",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-from-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "intercept",
    "description" : "Camel YAML DSL JSON schema: intercept",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-intercept-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "interceptFrom",
    "description" : "Camel YAML DSL JSON schema: interceptFrom",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-interceptFrom-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "interceptSendToEndpoint",
    "description" : "Camel YAML DSL JSON schema: interceptSendToEndpoint",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-interceptSendToEndpoint-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "onCompletion",
    "description" : "Camel YAML DSL JSON schema: onCompletion",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-onCompletion-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "onException",
    "description" : "Camel YAML DSL JSON schema: onException",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-onException-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "routeConfiguration",
    "description" : "Camel YAML DSL JSON schema: routeConfiguration",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-routeConfiguration-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "route",
    "description" : "Camel YAML DSL JSON schema: route",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-route-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "routeTemplate",
    "description" : "Camel YAML DSL JSON schema: routeTemplate",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-routeTemplate-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "templatedRoute",
    "description" : "Camel YAML DSL JSON schema: templatedRoute",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-templatedRoute-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "restConfiguration",
    "description" : "Camel YAML DSL JSON schema: restConfiguration",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-restConfiguration-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "rest",
    "description" : "Camel YAML DSL JSON schema: rest",
    "version" : "4.1.0-SNAPSHOT",
    "file" : "camelYamlDsl-rest-4.1.0-SNAPSHOT.json"
  }, {
    "name" : "Integration",
    "description" : "Integration",
    "version" : "2.1.0-SNAPSHOT",
    "file" : "crd-schema-integrations-2.1.0-SNAPSHOT.json"
  }, {
    "name" : "KameletBinding",
    "description" : "KameletBinding",
    "version" : "2.1.0-SNAPSHOT",
    "file" : "crd-schema-kameletbindings-2.1.0-SNAPSHOT.json"
  }, {
    "name" : "Kamelet",
    "description" : "Kamelet",
    "version" : "2.1.0-SNAPSHOT",
    "file" : "crd-schema-kamelets-2.1.0-SNAPSHOT.json"
  }, {
    "name" : "Pipe",
    "description" : "Pipe",
    "version" : "2.1.0-SNAPSHOT",
    "file" : "crd-schema-pipes-2.1.0-SNAPSHOT.json"
  } ]
}

Fixes: KaotoIO#147

ATM sub schemas are not used by UI. We'll soon use for Beans editor (#8) and will be easier to identify the sub schema by its name being same as the property name - for example, `beans` to be a name for the beans sub schema. The old verbose name were moved as `description` in the index.json.
We might want to generate an enum of these sub schema names and put in .d.ts.
@igarashitm
Copy link
Contributor Author

Or, it might be even better to make schemas map as well instead of array?

@lordrip
Copy link
Member

lordrip commented Sep 23, 2023

Or, it might be even better to make schemas map as well instead of array?

Considering that this file's purpose is to serve as an entry point to know what to download, I don't think that makes much difference on the UI side, performance-wise.

The only difference I can think of is that the schema order will be randomized, but it probably won't make much difference.

That being said, is there a difference on the java side that perhaps I'm not considering?

Copy link
Member

@lordrip lordrip left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @igarashitm

@lordrip lordrip merged commit 66bdd77 into KaotoIO:main Sep 23, 2023
5 checks passed
@igarashitm
Copy link
Contributor Author

@lordrip it's more for keeping the code a bit cleaner, as it needs to iterate and find the element if it's array as opposed to Map which has direct access.

@lordrip
Copy link
Member

lordrip commented Sep 23, 2023

@igarashitm alright, then there's an advantage, let's go for it then 💪

igarashitm added a commit to igarashitm/kaoto that referenced this pull request Sep 25, 2023
igarashitm added a commit to igarashitm/kaoto that referenced this pull request Sep 25, 2023
igarashitm added a commit to igarashitm/kaoto that referenced this pull request Sep 25, 2023
lordrip pushed a commit that referenced this pull request Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Let UI use maven generated YAML DSL sub schema
2 participants