Skip to content

Conversation

guineveresaenger
Copy link
Contributor

Example of schemagen using pulumi/pulumi-terraform-bridge#3188.

  • Generate schema and Node SDK from tip of bridge
  • Schema with markups
  • generate sdks

@guineveresaenger guineveresaenger changed the title Sample of SDK gen using schema filter functionality [DO NOT MERGE] Sample of SDK gen using schema filter functionality Sep 13, 2025
guineveresaenger added a commit to pulumi/pulumi-terraform-bridge that referenced this pull request Sep 29, 2025
This pull request does several things:

1. Changes the `fixUpPropertyReference` function to mark up any such
reference with a <span> tag that contains language-specific keys and
values so a language-specific filter function can identify which value
should be used for the language selected.
The span looks as follows in the schema:
`\u003cspan pulumi-lang-nodejs=\"`minUpper`\"
pulumi-lang-dotnet=\"`MinUpper`\" pulumi-lang-go=\"`minUpper`\"
pulumi-lang-python=\"`min_upper`\" pulumi-lang-yaml=\"`minUpper`\"
pulumi-lang-java=\"`minUpper`\"\u003e`min_upper`\u003c/span\u003e`
2. Starts to fix a bug in `fixUpPropertyReference` where Dotnet was
generating some property names in `snake_case` (TODO: proper
capitalization for these property names is still missing) - see
[example](https://github.com/pulumi/pulumi-random/pull/1869/files#diff-81676d671ec0f669c06325b0f7c93214146c124ccbf80cf9a624b183148b6059R51)
3. Creates a filter function that reads the provider's main schema from
file and filters it for the correct language selectors on these spans
and on the Pulumi Code Chooser (to avoid repeating examples
translation), instead of re-generating the schema from scratch.
4. Adds new tests for `fixUpPropertyReference`; adds tests for the
filter function.

In this [pulumi-random
PR](pulumi/pulumi-random#1869), you can see the
changes to the SDK are minimal (the azure -> azurerm is unrelated; the
Java changes are due to
#3184 and haven't
been rolled out to providers.

Additional benefits:
- We could use these spans in registry docsgen to fix up the broken
default variable inflections there
- Build time for the AWS Node SDK went from 130s to 26s; other SDKs are
similar; smaller providers build the SDK almost instantaneously
- Prompted us to build the Java SDK via pulumi package gen-sdk, reducing
much future maintainer toil - it jsut comes for free with the Pulumi
binary!
- Paves the way for decoupling SDKgen from the terraform bridge in the
future.

This pull request does not address the following:

- some conversion stat cleanup should happen for the SDK gen pass -
we're still seeing conversion stat output, which is nonsensical. This
can be in a separate pull request IMO.

[I ran this against the AWS provider as
well](pulumi/pulumi-aws#5825). The SDK inline
documentation has a few extra empty section headers with this change,
because we're not running the `description` field through the docs
generator twice. **I think this is the correct bargain to make** - after
this change, we can fix the docs rendering in _one_ place, and have the
schema be the source of truth for everything.

Fixes #1918.
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.

1 participant