-
Notifications
You must be signed in to change notification settings - Fork 67
Enable export operation to have own schema
#1566
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
base: main
Are you sure you want to change the base?
Changes from all commits
345a1a9
a457f02
c2a7fe0
d2ea2b2
3c91d5b
717aa38
4022991
6f511d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| Describe 'Resource export tests' { | ||
| It "Export with <resource> accepts input '<json>' and returns filtered results" -TestCases @( | ||
| @{ resource = 'Test/ExportSchemaCommand'; json = '{ "name": "Gijs" }'; expected = @('Gijs') }, | ||
| @{ resource = 'Test/ExportSchemaCommand'; json = '{ "name": "*e*" }'; expected = @('Steve', 'Tess') }, | ||
| @{ resource = 'Test/ExportSchemaEmbedded'; json = '{ "name": "Gijs" }'; expected = @('Gijs') }, | ||
| @{ resource = 'Test/ExportSchemaEmbedded'; json = '{ "name": "*e*" }'; expected = @('Steve', 'Tess') }, | ||
| @{ resource = 'Test/ExportSchemaNoFiltering'; json = '{ "name": "Gijs" }'; expected = @('Steve', 'Tess', 'Gijs') } | ||
| ){ | ||
| param($resource, $json, $expected) | ||
|
|
||
| $output = dsc resource export -r $resource -i $json 2>$TESTDRIVE/error.log | ConvertFrom-Json | ||
| $errorlog = Get-Content "$TESTDRIVE/error.log" -Raw | ||
| $LASTEXITCODE | Should -Be 0 -Because $errorlog | ||
| $output.resources.count | Should -Be $expected.Count -Because ($output | ConvertTo-Json -Depth 4) | ||
| $output.resources.properties.name | Should -Be $expected -Because ($output | ConvertTo-Json -Depth 4) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,6 +206,18 @@ pub enum SchemaKind { | |
| Embedded(Value), | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema, DscRepoSchema)] | ||
| #[dsc_repo_schema(base_name = "manifest.exportSchema", folder_path = "definitions")] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub enum ExportSchemaKind { | ||
| /// The export schema is returned by running a command. | ||
| Command(SchemaCommand), | ||
| /// The export schema is embedded in the manifest. | ||
| Embedded(Value), | ||
| /// The export operation does not support filtering. | ||
| NoFiltering, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's discuss in WG today
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed in WG, change to:
|
||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema)] | ||
| pub struct SchemaCommand { | ||
| /// The command to run to get the schema. | ||
|
|
@@ -321,6 +333,7 @@ pub struct ExportMethod { | |
| /// The security context required to run the Export method. Default if not specified is `current`. | ||
| #[serde(rename = "requireSecurityContext", skip_serializing_if = "Option::is_none")] | ||
| pub require_security_context: Option<SecurityContextKind>, | ||
| pub schema: Option<ExportSchemaKind>, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema, DscRepoSchema)] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.