Skip to content

Commit

Permalink
fix: use raw string in generated schema docs
Browse files Browse the repository at this point in the history
Signed-off-by: jakezhu9 <[email protected]>
  • Loading branch information
jakezhu9 committed Jan 15, 2024
1 parent 1aa2cbb commit 74a58f7
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pkg/tools/gen/templates/kcl/schema.gotmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
schema {{ formatName .Name }}:
"""{{- "\n" }}
r"""{{- "\n" }}
{{- template "document" . }}
"""{{- "\n" }}

Expand Down
4 changes: 2 additions & 2 deletions pkg/tools/gen/testdata/jsonschema/additional/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Ethernet:
"""
r"""
Ethernet

Attributes
Expand All @@ -17,7 +17,7 @@ schema Ethernet:
socket?: EthernetSocket = {"HTTP": 80, "HTTPS": 443}

schema EthernetSocket:
"""
r"""
EthernetSocket
"""

Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/gen/testdata/jsonschema/basic/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Book:
"""
r"""
Book

Attributes
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/gen/testdata/jsonschema/const/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Book:
"""
r"""
Book

Attributes
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/gen/testdata/jsonschema/document/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema MyOrder:
"""
r"""
Schema for representing an order information.
It contains the order number, list of items and the current status.

Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/gen/testdata/jsonschema/items/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Book:
"""
r"""
Book

Attributes
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/gen/testdata/jsonschema/multipleof/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Book:
"""
r"""
Book

Attributes
Expand Down
10 changes: 5 additions & 5 deletions pkg/tools/gen/testdata/jsonschema/nested-items/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema MonacoManifestSchema:
"""
r"""
MonacoManifestSchema

Attributes
Expand All @@ -22,7 +22,7 @@ schema MonacoManifestSchema:
environment_groups: [MonacoManifestSchemaEnvironmentGroupsItems0]

schema MonacoManifestSchemaEnvironmentGroupsItems0:
"""
r"""
MonacoManifestSchemaEnvironmentGroupsItems0

Attributes
Expand All @@ -37,7 +37,7 @@ schema MonacoManifestSchemaEnvironmentGroupsItems0:
environments?: [MonacoManifestSchemaEnvironmentGroupsItems0EnvironmentsItems0]

schema MonacoManifestSchemaEnvironmentGroupsItems0EnvironmentsItems0:
"""
r"""
MonacoManifestSchemaEnvironmentGroupsItems0EnvironmentsItems0

Attributes
Expand All @@ -52,7 +52,7 @@ schema MonacoManifestSchemaEnvironmentGroupsItems0EnvironmentsItems0:
url?: MonacoManifestSchemaEnvironmentGroupsItems0EnvironmentsItems0Url

schema MonacoManifestSchemaEnvironmentGroupsItems0EnvironmentsItems0Url:
"""
r"""
The URL of this environment

Attributes
Expand All @@ -67,7 +67,7 @@ schema MonacoManifestSchemaEnvironmentGroupsItems0EnvironmentsItems0Url:
value?: str

schema MonacoManifestSchemaProjectsItems0:
"""
r"""
MonacoManifestSchemaProjectsItems0

Attributes
Expand Down
4 changes: 2 additions & 2 deletions pkg/tools/gen/testdata/jsonschema/nested/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Book:
"""
r"""
Book

Attributes
Expand All @@ -17,7 +17,7 @@ schema Book:
author?: BookAuthor

schema BookAuthor:
"""
r"""
BookAuthor

Attributes
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/gen/testdata/jsonschema/pattern/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
import regex

schema Cronjob:
"""
r"""
Cronjob

Attributes
Expand Down
6 changes: 3 additions & 3 deletions pkg/tools/gen/testdata/jsonschema/ref/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Customer:
"""
r"""
Customer

Attributes
Expand All @@ -17,7 +17,7 @@ schema Customer:
address?: Address

schema Address:
"""
r"""
Address

Attributes
Expand All @@ -30,7 +30,7 @@ schema Address:
state?: State

schema State:
"""
r"""
State

Attributes
Expand Down
6 changes: 3 additions & 3 deletions pkg/tools/gen/testdata/jsonschema/unsupport/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Shop:
"""
r"""
Schema for representing a shop information.
In this test case, we use some logic keywords like "oneOf" that can't be directly converted at the moment. To make it still work, we'll convert it into "any" type.

Expand All @@ -16,14 +16,14 @@ schema Shop:
products?: any

schema Clothing:
"""
r"""
Clothing
"""

[...str]: any

schema Product:
"""
r"""
Product

Attributes
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/gen/testdata/jsonschema/validation/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema Book:
"""
r"""
Book

Attributes
Expand Down
6 changes: 3 additions & 3 deletions pkg/tools/gen/testdata/terraform/expect.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""

schema AlicloudConfigRule:
"""
r"""
AlicloudConfigRule

Attributes
Expand All @@ -17,7 +17,7 @@ schema AlicloudConfigRule:
resource_types_scope?: [str]

schema AlicloudDbInstance:
"""
r"""
AlicloudDbInstance

Attributes
Expand All @@ -40,7 +40,7 @@ schema AlicloudDbInstance:
isunique(security_ips)

schema ComplianceItem:
"""
r"""
ComplianceItem

Attributes
Expand Down

0 comments on commit 74a58f7

Please sign in to comment.