Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TOP IDE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TDL Open Source
TOP IDE
Commits
597ecd5f
Commit
597ecd5f
authored
2 weeks ago
by
Martti Käärik
Browse files
Options
Downloads
Patches
Plain Diff
Basic importing for anyOf/allOf/oneOf schemas (TODO Java mappings)
parent
301cda7d
No related branches found
Branches containing commit
Tags
20250326.09.07
Tags containing commit
No related merge requests found
Pipeline
#12840
passed
2 weeks ago
Stage: build
Stage: prepare
Stage: upload
Stage: release
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/org.etsi.mts.tdl.openapi2tdl.next/src/org/etsi/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java
+23
-6
23 additions, 6 deletions
...i/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java
with
23 additions
and
6 deletions
plugins/org.etsi.mts.tdl.openapi2tdl.next/src/org/etsi/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java
+
23
−
6
View file @
597ecd5f
...
...
@@ -436,9 +436,25 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator {
}
}
}
private
void
getAllProperties
(
Schema
<?>
schema
,
Map
<
String
,
Schema
>
properties
)
{
List
<
Schema
>
xOf
=
schema
.
getAllOf
();
if
(
xOf
==
null
)
xOf
=
schema
.
getAnyOf
();
if
(
xOf
==
null
)
xOf
=
schema
.
getOneOf
();
if
(
xOf
!=
null
)
{
for
(
Schema
ofSchema
:
xOf
)
this
.
getAllProperties
(
ofSchema
,
properties
);
}
if
(
schema
.
getProperties
()
!=
null
)
properties
.
putAll
(
schema
.
getProperties
());
}
private
DataType
translate
(
Schema
<?>
schema
,
String
prefix
,
DataType
superType
)
{
if
(
getSchemaType
(
schema
)
==
null
&&
(
schema
.
getProperties
()
==
null
||
schema
.
getProperties
().
isEmpty
()))
{
Map
<
String
,
Schema
>
properties
=
new
Hashtable
<>();
this
.
getAllProperties
(
schema
,
properties
);
if
(
getSchemaType
(
schema
)
==
null
&&
properties
.
isEmpty
())
{
if
(
schema
.
getName
()
==
null
)
{
System
.
out
.
println
(
"Why?"
);
}
...
...
@@ -448,8 +464,7 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator {
if
(
schema
.
getName
()
==
null
)
{
name
=
prefix
+
"___item"
;
}
if
(
schema
.
getProperties
()
!=
null
&&
!
schema
.
getProperties
().
isEmpty
()
||
getSchemaType
(
schema
).
equals
(
"object"
))
{
if
(!
properties
.
isEmpty
()
||
getSchemaType
(
schema
).
equals
(
"object"
))
{
DataType
t
=
translateObject
(
schema
,
name
);
addSuperType
(
t
,
superType
);
return
t
;
...
...
@@ -505,12 +520,14 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator {
}
private
DataType
translateObject
(
Schema
<?>
schema
,
String
name
)
{
Map
<
String
,
Schema
>
properties
=
new
Hashtable
<>();
this
.
getAllProperties
(
schema
,
properties
);
StructuredDataType
dataType
=
getStructuredDataTypeFor
(
name
);
if
(
schema
.
getProperties
()
==
null
||
!
dataType
.
getMember
().
isEmpty
())
{
if
(
properties
.
isEmpty
()
||
!
dataType
.
getMember
().
isEmpty
())
{
return
dataType
;
}
for
(
Object
propertyName
:
schema
.
getP
roperties
()
.
keySet
())
{
Schema
<?>
propertySchema
=
(
Schema
<?>)
schema
.
getP
roperties
()
.
get
(
propertyName
);
for
(
Object
propertyName
:
p
roperties
.
keySet
())
{
Schema
<?>
propertySchema
=
(
Schema
<?>)
p
roperties
.
get
(
propertyName
);
String
reference
=
propertySchema
.
get
$ref
();
DataType
memberType
=
null
;
if
(
reference
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment