Skip to content

how to refer generated object in another pkl file #1060

Answered by HT154
Rasool-Ansari-Shaik asked this question in Q&A

You must be logged in to vote

The core issue is that you're attempting property access when you want to be subscripting. There are a couple more design/style things you may want to consider:

  • In several places you're not typing your properties, which will affect type checking fidelity and IDE editing experiences
  • It's generally best practice to use Listing/Mapping over List/Map when defining values. The latter are intended for "internal" data manipulation, not for use in module schemas.
  • "inline" object definition members should be ;-separated

Here's how I might write this accounting for this (and following the style guide):

module template_schemas

class JsonSchemaConfig {
  type: String = "template"
  templateId: String

Replies: 1 comment

You must be logged in to vote
0 replies
Answer selected by Rasool-Ansari-Shaik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants