Skip to content

Commit

Permalink
Add test (#1)
Browse files Browse the repository at this point in the history
* add test

* Update ModuleGenerator.pkl-expected.pcf

* plural
  • Loading branch information
valerio-iachini authored and holzensp committed Feb 21, 2024
1 parent 8c958f6 commit a752380
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
40 changes: 40 additions & 0 deletions packages/org.json_schema.contrib/tests/ModuleGenerator.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,46 @@ examples {
}
new ModuleGenerator { rootSchema = schema ; moduleName = "com.apple.Example" }.moduleNode.render("")
}
["classes within definitions properties"] {
local schema: JsonSchema = new {
local self = this
properties {
["foo"] {
$ref = "#/definitions/foo"
$$baseSchema = self
}
["bar"] {
$ref = "#/definitions/bar"
$$baseSchema = self
}
}
definitions {
["foo"] {
properties {
["waldo"] {
properties {
["qux"] {
type = "string"
}
}
}
}
}
["bar"] {
properties {
["waldo"] {
properties {
["corge"] {
type = "string"
}
}
}
}
}
}
}
new ModuleGenerator { rootSchema = schema ; moduleName = "com.apple.Example" }.moduleNode.render("")
}
["classes from inline positions"] {
local schema: JsonSchema = new {
local self = this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,35 @@ examples {

"""
}
["classes within definitions properties"] {
"""
/// This module was generated from JSON Schema from <>.
///
/// WARN: unable to determine module-level properties on the root schema.
module com.apple.Example

foo: Foo?

bar: Bar?

class Foo {
waldo: Waldo?
}

class Waldo {
qux: String?
}

class Bar {
waldo: BarWaldo?
}

class BarWaldo {
corge: String?
}

"""
}
["classes from inline positions"] {
"""
/// This module was generated from JSON Schema from <>.
Expand Down

0 comments on commit a752380

Please sign in to comment.