Skip to content

feat(form): add decoupled extension schema parser - #23

Merged
colinjlacy merged 3 commits into
runtimeconditions:mainfrom
abhinavkdeval08-design:feat/form-condition-declarations-16
Nov 30, 2026
Merged

colinjlacy merged 3 commits into
runtimeconditions:mainfrom
abhinavkdeval08-design:feat/form-condition-declarations-16

Conversation

@abhinavkdeval08-design

@abhinavkdeval08-design abhinavkdeval08-design commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Refs #16

hey @colinjlacy — here's part 1 of #16 with the decoupled TypeScript schema parser under src/form/ (no Backstage UI dependencies, so we can reuse it directly in runtimeconditions/runtimeconditions.github.io#10 too).

What's in here:

  • src/form/types.ts & src/form/catalog.ts: parses RuntimeConditionsExtensionDefinition manifests, extracts both interface.* and condition-level fields (env, configuration), keeps raw field names as labels for developer familiarity, and captures if/then conditional rules.
  • src/form/form.test.ts: unit tests covering schema parsing and condition form extraction.

Scope notes (per review feedback):

  • The profile YAML generator has been pulled out of this PR and stashed on stash/generator-draft.
  • Not handled yet, planned for follow-up PRs: chained extensions (e.g. env-configuration extending common-integrations, which parseExtensionDefinition currently rejects), recursion into nested object fields (e.g. api.http), and the generator.

Thanks for the thorough review!

…nerator

Signed-off-by: Abhinav Deval <abhinavkdeval08@gmail.com>
Comment thread src/form/catalog.ts Outdated
Comment on lines +15 to +18
export function formatFieldLabel(propName: string): string {
if (!propName) return '';

const acronymMap: Record<string, string> = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure that we need this. We intentionally won't have environment-specific values in our forms (e.g. MiB, HTTPS, etc.) and we would never be able to get ahead of all possible acronyms anyway.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Makes sense, removed it. Labels are plain Title Case now (so minMemoryMiB shows up as "Min Memory Mi B", which I'm fine with).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@abhinavkdeval08-design does it need to be Title Case? I do feel a little weird suggesting this, but since our end users are most likely to be developers, can we just use the field names as they are?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Makes complete sense. Punted on the blanket Title Case conversion.. formatFieldLabel now preserves the raw property name as-is so devs see the exact YAML/JSON fields they expect. Ready to go!

Comment thread src/form/catalog.ts Resolved
Comment thread src/form/catalog.ts Resolved
Comment thread src/form/catalog.ts Resolved
Comment thread src/form/catalog.ts Resolved
Comment thread src/form/catalog.ts Resolved
Comment thread src/form/catalog.ts Resolved
Comment thread src/form/catalog.ts Resolved
Comment thread src/form/generator.ts Resolved
Comment thread src/form/generator.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This file is well written and will certainly be necessary. I'm just a little concerned that it may be premature to have this file written. Do we feel confident enough about what the form submission interface will look like that we can adequately create a generator script?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fair concern. I'm not sure the submission interface is settled: right now it takes the field descriptors plus a flat values map, and it doesn't cover persistence or prefill from the issue. Happy to pull generator.ts out of this PR and land the parser first, or keep it as a first cut. Whichever you prefer.

@colinjlacy colinjlacy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@abhinavkdeval08-design Really great first pass. I do have a few changes requested, but don't be discouraged. You're doing something that's bonkers hard and will therefore have a lot of tweaks here and there.

The one thing that I was looking for and didn't see was how we would handle extensions that extend other extensions. the env-configuration extension extends common-integrations, partially because it should indeed be optional to declare env vars, but also as a way of proving that the chained extensions approach works. You can/should use that combo as a test case.

We also have examples of nested condition fields. You can find those in common-integrations as well, in the api.http kind/type.

@abhinavkdeval08-design

Copy link
Copy Markdown
Member Author

Thanks, and good call on the chained extensions. It's not handled yet. parseExtensionDefinition currently throws on env-configuration because it has no spec.kinds (it uses spec.dependencies on common-integrations instead). To support it, the two would need to be loaded together. Nested fields like api.http are the same story as the recursion thread above. Do you want that in this PR or a follow-up?

@abhinavkdeval08-design

Copy link
Copy Markdown
Member Author

Pushed 466f8a3 addressing the inline comments. The generator and chaining threads are open questions for you.

@colinjlacy

colinjlacy commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

I would suggest removing the generator from this PR and stashing it for later. It looks like it would work as a baseline, but until we have chained extensions and object recursion figured out, it'll just be more to maintain.

You can address chained dependencies an object recursion in the next PR if you like.

Looking at the rest now...

@colinjlacy colinjlacy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just the one open question on how the prop name is being formatted. I'm very curious about whether or not it's necessary. Same with how the values are presented. Devs are typically used to JSONing and YAMLing in lowercase and snake case, so I'm curious how it would be received if presented in a form.

People could legit hate it. But they could also end up disliking a blanket formatting approach.

There may be (or likely are) JS libs that help address this, and could be used for rendering. So maybe we punt on this one for now?

…s labels

Signed-off-by: Abhinav Deval <abhinavkdeval08@gmail.com>
@abhinavkdeval08-design abhinavkdeval08-design changed the title feat(form): add decoupled extension schema parser and profile YAML generator feat(form): add decoupled extension schema parser Nov 30, 2026
@colinjlacy
colinjlacy merged commit eb69637 into runtimeconditions:main Nov 30, 2026
5 checks passed
@abhinavkdeval08-design
abhinavkdeval08-design deleted the feat/form-condition-declarations-16 branch November 30, 2026 10:17
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.

2 participants