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

Include the schema in the provider #8

Closed
justinvp opened this issue Feb 10, 2022 · 0 comments · Fixed by #10
Closed

Include the schema in the provider #8

justinvp opened this issue Feb 10, 2022 · 0 comments · Fixed by #10
Assignees
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Milestone

Comments

@justinvp
Copy link
Member

justinvp commented Feb 10, 2022

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

The schema should be packaged up and included in the provider to make it available from the provider's GetSchema method.

This can be done by setting an optional string schema property that's defined on the Provider interface.

I suspect we'd implement this in a similar way to how the provider's version is set: Include the schema.json file in the NPM package, and then at runtime read it the same way we read package.json to get the version:

let version: string = require("./package.json").version;
// Node allows for the version to be prefixed by a "v",
// while semver doesn't. If there is a v, strip it off.
if (version.startsWith("v")) {
version = version.slice(1);
}
return pulumi.provider.main(new Provider(version), args);

Be aware: if we're switching the schema to be defined in YAML rather than JSON, it'll still need to be returned as a JSON string from the provider, so the YAML would need to be converted to JSON. See #9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
3 participants