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

Add cyclic-types output #313

Merged
merged 3 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure no files have changed
run: git diff --exit-code
run: git add . && git diff --quiet && git diff --cached --quiet

- uses: actions/upload-artifact@v4
with:
Expand Down
18 changes: 18 additions & 0 deletions pulumi_wasm_generator_lib/tests/output/cyclic-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "main"
version = "0.0.1"
edition = "2021"

[workspace]
members = [
"provider",
"lib"
]

[workspace.dependencies]
wit-bindgen-rt = "0.27.0"
wit-bindgen = "0.27.0"
automod = "1.0.14"
pulumi_wasm_common = { path = "../../../../pulumi_wasm_common" }
pulumi_wasm_rust = { path = "../../../../pulumi_wasm_rust" }
serde = "1.0.197"
13 changes: 13 additions & 0 deletions pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "pulumi_wasm_example"
version = "0.0.1-0.0.0-DEV"
edition = "2021"

[dependencies]
wit-bindgen.workspace = true
pulumi_wasm_rust.workspace = true
serde.workspace = true
automod.workspace = true

[package.metadata.pulumi]
related_crate = "pulumi_wasm_example_provider"
11 changes: 11 additions & 0 deletions pulumi_wasm_generator_lib/tests/output/cyclic-types/lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use pulumi_wasm_rust::Output;
pub mod resource;
pub mod types;

mod bindings {
wit_bindgen::generate!({
// the name of the world in the `*.wit` input file
world: "example-pulumi-client",
});
}

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

#[derive(serde::Serialize)]
pub struct AcyclicReferent {
#[serde(rename = "bar")]
pub r#bar: Box<crate::types::IndirectCycleS>,
#[serde(rename = "baz")]
pub r#baz: Box<crate::types::IndirectCycleT>,
#[serde(rename = "foo4")]
pub r#foo_4: Box<crate::types::DirectCycle>,
}


#[derive(serde::Serialize)]
pub struct AcyclicS {
#[serde(rename = "foo5")]
pub r#foo_5: Box<String>,
}


#[derive(serde::Serialize)]
pub struct AcyclicT {
#[serde(rename = "foo6")]
pub r#foo_6: Box<crate::types::AcyclicS>,
}


#[derive(serde::Serialize)]
pub struct DirectCycle {
#[serde(rename = "foo")]
pub r#foo: Box<crate::types::DirectCycle>,
}


#[derive(serde::Serialize)]
pub struct IndirectCycleS {
#[serde(rename = "foo2")]
pub r#foo_2: Box<crate::types::IndirectCycleT>,
}


#[derive(serde::Serialize)]
pub struct IndirectCycleT {
#[serde(rename = "foo3")]
pub r#foo_3: Box<crate::types::IndirectCycleS>,
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package component:[email protected];

interface output-interface {

resource output {
constructor(value: string);
map: func(function-name: string) -> output;
duplicate: func() -> output;
}
combine: func(outputs: list<output>) -> output;
}


interface register-interface {
use output-interface.{output};

record object-field {
name: string,
value: borrow<output>
}

record result-field {
name: string
}

record register-resource-result-field {
name: string,
output: output
}

record register-resource-request {
%type: string,
name: string,
object: list<object-field>,
results: list<result-field>
}

record register-resource-result {
fields: list<register-resource-result-field>
}

register: func(request: register-resource-request) -> register-resource-result;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package pulumi:[email protected];

world example-pulumi {
import component:pulumi-wasm/[email protected];
}

world example-pulumi-client {
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "pulumi_wasm_example_provider"
version = "0.0.1-0.0.0-DEV"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib"]

[dependencies]
wit-bindgen-rt.workspace = true
pulumi_wasm_common.workspace = true

[package.metadata.component]
package = "pulumi:example"

[package.metadata.component.target]
path = "wit"
world = "example-pulumi"

[package.metadata.component.target.dependencies]
"component:pulumi-wasm" = { path = "wit/deps/pulumi-wasm.wit" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


struct Component {}

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package component:[email protected];

interface output-interface {

resource output {
constructor(value: string);
map: func(function-name: string) -> output;
duplicate: func() -> output;
}
combine: func(outputs: list<output>) -> output;
}


interface register-interface {
use output-interface.{output};

record object-field {
name: string,
value: borrow<output>
}

record result-field {
name: string
}

record register-resource-result-field {
name: string,
output: output
}

record register-resource-request {
%type: string,
name: string,
object: list<object-field>,
results: list<result-field>
}

record register-resource-result {
fields: list<register-resource-result-field>
}

register: func(request: register-resource-request) -> register-resource-result;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package pulumi:[email protected];

world example-pulumi {
import component:pulumi-wasm/[email protected];
}

world example-pulumi-client {
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.80.1"
targets = ["wasm32-wasip1"]
55 changes: 55 additions & 0 deletions pulumi_wasm_generator_lib/tests/output/cyclic-types/schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: "0.0.1"
name: example
types:
example::DirectCycle:
type: object
properties:
foo:
$ref: "#/types/example::DirectCycle"
required: [ foo ]
example::IndirectCycleS:
type: object
properties:
foo2:
$ref: "#/types/example::IndirectCycleT"
required: [ foo2 ]
example::IndirectCycleT:
type: object
properties:
foo3:
$ref: "#/types/example::IndirectCycleS"
required: [ foo3 ]
example::AcyclicReferent:
type: object
properties:
foo4:
$ref: "#/types/example::DirectCycle"
bar:
$ref: "#/types/example::IndirectCycleS"
baz:
$ref: "#/types/example::IndirectCycleT"
required: [ foo4, bar, baz ]
example::AcyclicS:
type: object
properties:
foo5:
type: string
required: [ foo5 ]
example::AcyclicT:
type: object
properties:
foo6:
$ref: "#/types/example::AcyclicS"
required: [ foo6 ]
language:
go:
{
"importBasePath": "cyclic-types/example",
"generateExtraInputTypes": true,
}
nodejs:
{
"dependencies": { "@pulumi/pulumi": "^3.12" },
"devDependencies": { "typescript": "^3.7.0" },
}
python: {}
Empty file.
Loading