Skip to content

Commit

Permalink
make external model references standard conform
Browse files Browse the repository at this point in the history
  • Loading branch information
Eiko Thomas committed Aug 9, 2019
1 parent b3da095 commit 928b94c
Show file tree
Hide file tree
Showing 5 changed files with 887 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Releases.md
@@ -1,3 +1,7 @@
## 0.13.1
- handle the right notation of external references: e.g. ./object_base.json#/definitions/ObjectBase

(Attention, the wrong reference style before that version, is still working)
## 0.8.4
- add additional generator parameters to improve plantuml view (ignoreAttribs,ignoreRefs,ignoreImplicitRefs, ignoreCompositions)

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -9,7 +9,7 @@ sourceCompatibility = 8
def mainClass='de.lisaplus.atlas.DoCodeGen'

project.group = 'de.lisaplus.tools'
project.version = '0.13.0'
project.version = '0.13.1'


task sourcesJar(type: Jar) {
Expand Down
Expand Up @@ -386,6 +386,9 @@ class JsonSchemaBuilder implements IModelBuilder {
throw new Exception("loaded model doesn't contain types")
}
def desiredName = refStr.substring(indexOfTrenner+EXT_REF_TRENNER.length()).toLowerCase()
if (desiredName.startsWith('definitions/')) {
desiredName = desiredName.substring('definitions/'.length())
}
Type extT2 = null
tmpModel.types.each { type ->
if ((type.name!=null) && (type.name.toLowerCase()==desiredName)) {
Expand Down
Expand Up @@ -394,4 +394,13 @@ class JsonSchemaBuilder {
assertNotNull(model)
}

@Test
void lisaInesTypes_externalRef() {
def modelFile = new File('src/test/resources/test_schemas/ds/lisa-ines-network_new_references.json')
assertTrue(modelFile.isFile())
def builder = new de.lisaplus.atlas.builder.JsonSchemaBuilder()
def model = builder.buildModel(modelFile)
assertNotNull(model)
}

}

0 comments on commit 928b94c

Please sign in to comment.