Skip to content

Commit e627d14

Browse files
committed
refactor: better go module import impl
Signed-off-by: peefy <[email protected]>
1 parent 1460c5c commit e627d14

File tree

10 files changed

+1535
-519
lines changed

10 files changed

+1535
-519
lines changed

pkg/tools/gen/genkcl_gostruct.go

+228-97
Large diffs are not rendered by default.

pkg/tools/gen/genkcl_gostruct_test.go

+1,288-404
Large diffs are not rendered by default.

pkg/tools/gen/template.go

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ var kclKeywords = map[string]struct{}{
123123
"else": {},
124124
"elif": {},
125125
"for": {},
126+
"type": {},
126127
"schema": {},
127128
"mixin": {},
128129
"protocol": {},

pkg/tools/gen/testdata/jsonschema/allof/expect.k

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ schema ShopProductsOneOf0:
2121

2222
Attributes
2323
----------
24-
type : "clothing", required, default is "clothing"
24+
$type : "clothing", required, default is "clothing"
2525
material : str, optional
2626
name : str, required
2727
price : float, optional
2828
"""
2929

30-
type: "clothing" = "clothing"
30+
$type: "clothing" = "clothing"
3131
material?: str
3232
name: str
3333
price?: float
@@ -41,13 +41,13 @@ schema ShopProductsOneOf1Items0:
4141

4242
Attributes
4343
----------
44-
type : "clothing", required, default is "clothing"
44+
$type : "clothing", required, default is "clothing"
4545
material : str, optional
4646
name : str, required
4747
price : float, optional
4848
"""
4949

50-
type: "clothing" = "clothing"
50+
$type: "clothing" = "clothing"
5151
material?: str
5252
name: str
5353
price?: float

pkg/tools/gen/testdata/jsonschema/complex-workflow/expect.k

+4-4
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ schema WorkflowOnOneOf2WorkflowCallInputsPatternProperties0:
15681568
A string shown to users using the deprecated input.
15691569
required : bool, required
15701570
A boolean to indicate whether the action requires the input parameter. Set to true when the parameter is required.
1571-
type : "boolean" | "number" | "string", required
1571+
$type : "boolean" | "number" | "string", required
15721572
Required if input is defined for the on.workflow_call keyword. The value of this parameter is a string specifying the data type of the input. This must be one of: boolean, number, or string.
15731573
default : bool | float | str, optional
15741574
The default value is used when an input parameter isn't specified in a workflow file.
@@ -1577,7 +1577,7 @@ schema WorkflowOnOneOf2WorkflowCallInputsPatternProperties0:
15771577
description?: str
15781578
deprecationMessage?: str
15791579
required: bool
1580-
type: "boolean" | "number" | "string"
1580+
$type: "boolean" | "number" | "string"
15811581
default?: bool | float | str
15821582

15831583
schema WorkflowOnOneOf2WorkflowCallSecrets:
@@ -1641,7 +1641,7 @@ schema WorkflowOnOneOf2WorkflowDispatchInputsPatternProperties0:
16411641
A boolean to indicate whether the action requires the input parameter. Set to true when the parameter is required.
16421642
default : any, optional
16431643
A string representing the default value. The default value is used when an input parameter isn't specified in a workflow file.
1644-
type : "string" | "choice" | "boolean" | "environment", optional
1644+
$type : "string" | "choice" | "boolean" | "environment", optional
16451645
A string representing the type of the input.
16461646
options : [str], optional
16471647
The options of the dropdown list, if the type is a choice.
@@ -1651,7 +1651,7 @@ schema WorkflowOnOneOf2WorkflowDispatchInputsPatternProperties0:
16511651
deprecationMessage?: str
16521652
required: bool
16531653
default?: any
1654-
type?: "string" | "choice" | "boolean" | "environment"
1654+
$type?: "string" | "choice" | "boolean" | "environment"
16551655
options?: [str]
16561656

16571657
check:

pkg/tools/gen/testdata/jsonschema/nested-items/expect.k

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ schema MonacoManifestSchemaEnvironmentGroupsItems0EnvironmentsItems0Url:
5757

5858
Attributes
5959
----------
60-
type : str, optional
60+
$type : str, optional
6161
Optional Type of URL definition.
6262
value : str, optional
6363
The value of the URL, based on type either an URL or environment variable name
6464
"""
6565

66-
type?: str
66+
$type?: str
6767
value?: str
6868

6969
schema MonacoManifestSchemaProjectsItems0:
@@ -74,13 +74,13 @@ schema MonacoManifestSchemaProjectsItems0:
7474
----------
7575
name : str, required
7676
The name of this project
77-
type : str, optional
77+
$type : str, optional
7878
Optional Type of this project. Default: Simple
7979
path : str, optional
8080
Optional filepath of the project relative to the manifest.yaml location. Defaults to name
8181
"""
8282

8383
name: str
84-
type?: str
84+
$type?: str
8585
path?: str
8686

pkg/tools/gen/testdata/jsonschema/oneof_parent_fields/expect.k

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ schema TopLevelDefinitionConfigsItems0:
2828
The monaco identifier for this config - is used in references and for some generated IDs in Dynatrace environments.
2929
config : TopLevelDefinitionConfigsItems0Config, required
3030
The actual configuration to be applied
31-
type : str | TopLevelDefinitionConfigsItems0TypeOneOf1 | TopLevelDefinitionConfigsItems0Type, required
31+
$type : str | TopLevelDefinitionConfigsItems0TypeOneOf1 | TopLevelDefinitionConfigsItems0Type, required
3232
The type of this configuration
3333
groupOverrides : [TopLevelDefinitionConfigsItems0GroupOverridesItems0], optional
3434
GroupOverrides overwrite specific parts of the Config when deploying it to any environment in a given group.
@@ -38,7 +38,7 @@ schema TopLevelDefinitionConfigsItems0:
3838

3939
id: str
4040
config: TopLevelDefinitionConfigsItems0Config
41-
type: str | TopLevelDefinitionConfigsItems0TypeOneOf1 | TopLevelDefinitionConfigsItems0Type
41+
$type: str | TopLevelDefinitionConfigsItems0TypeOneOf1 | TopLevelDefinitionConfigsItems0Type
4242
groupOverrides?: [TopLevelDefinitionConfigsItems0GroupOverridesItems0]
4343
environmentOverrides?: [TopLevelDefinitionConfigsItems0EnvironmentOverridesItems0]
4444

pkg/tools/gen/testdata/openapi/app/models/schema/v1/accessories/database.k

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ schema Database:
55

66
Attributes
77
----------
8-
type: str, default is Undefined, required.
8+
$type: str, default is Undefined, required.
99
Type defines the local deployment mode or the specific cloud vendor that
1010
provides the relational database service (rds).
1111
engine: str, default is Undefined, required.

pkg/tools/gen/testdata/openapi/app/models/schema/v1/workload/secret/secret.k

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ schema Secret:
1313

1414
Attributes
1515
----------
16-
type: str, default is Undefined, required.
16+
$type: str, default is Undefined, required.
1717
Type of secret, used to facilitate programmatic handling of secret data.
1818
params: {str,str}, default is Undefined, optional.
1919
Collection of parameters used to facilitate programmatic handling of secret data.

pkg/tools/gen/testdata/yaml/k8s-deployment/expect.k

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
5959
readOnlyRootFilesystem = True
6060
runAsNonRoot = True
6161
seccompProfile = {
62-
type = "RuntimeDefault"
62+
$type = "RuntimeDefault"
6363
}
6464
}
6565
}
@@ -95,7 +95,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
9595
readOnlyRootFilesystem = True
9696
runAsNonRoot = True
9797
seccompProfile = {
98-
type = "RuntimeDefault"
98+
$type = "RuntimeDefault"
9999
}
100100
}
101101
ports = [

0 commit comments

Comments
 (0)