Skip to content

Commit f37ce29

Browse files
committed
Reverse-engineer entities as ccomponents.schemas
1 parent c7977e8 commit f37ce29

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

package.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "OpenAPI",
3-
"version": "0.1.7",
4-
"versionDate": "2019-11-30",
3+
"version": "0.1.8",
4+
"versionDate": "2019-12-13",
55
"author": "hackolade",
66
"engines": {
77
"hackolade": "3.3.0",
@@ -21,10 +21,22 @@
2121
},
2222
"disableMultipleTypes": false,
2323
"enableReverseEngineering": {
24-
"jsonDocument": true,
25-
"jsonSchema": true,
26-
"ddl": false,
27-
"xsd": false,
24+
"jsonDocument": {
25+
"entities": false,
26+
"model_definitions": true
27+
},
28+
"jsonSchema": {
29+
"entities": false,
30+
"model_definitions": true
31+
},
32+
"ddl": {
33+
"entities": false,
34+
"model_definitions": true
35+
},
36+
"xsd": {
37+
"entities": false,
38+
"model_definitions": true
39+
},
2840
"plugin": true
2941
},
3042
"disableDenormalization": true,

reverse_engineering/api.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,17 @@ const handleOpenAPIData = (openAPISchema, fieldOrder) => new Promise((resolve, r
115115
})
116116
];
117117
}, []);
118-
return resolve({ hackoladeData, modelData });
118+
if (hackoladeData.length) {
119+
return resolve({ hackoladeData, modelData });
120+
}
121+
122+
return resolve({
123+
hackoladeData: [{
124+
objectNames: {},
125+
doc: { modelDefinitions: definitions }
126+
}],
127+
modelData
128+
});
119129
} catch (error) {
120130
return reject({ error: errorHelper.getConvertError(error), openAPISchema });
121131
}

reverse_engineering/helpers/dataHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ const getModelData = (schema) => {
766766
};
767767

768768
const getComponents = (schemaComponents = {}, fieldOrder) => {
769-
const schemasData = handleDefinitionSchemaProps(schemaComponents.schemas || {}, fieldOrder);
769+
const schemasData = handleObject(schemas => handleDefinitionSchemaProps(schemas || {}, fieldOrder), schemaComponents.schemas);
770770
const parametersData = handleObject(handleParameter, schemaComponents.parameters);
771771
const examplesData = handleObject(handleExample, schemaComponents.examples);
772772
const requestBodiesData = handleObject(handleRequestBody, schemaComponents.requestBodies);

snippets/definitions.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"properties": [{
66
"name": "schemas",
77
"type": "componentObject",
8-
"subtype": "schema"
8+
"subtype": "schema",
9+
"hackoladeMeta": {
10+
"source": true
11+
}
912
},{
1013
"name": "responses",
1114
"type": "componentObject",

0 commit comments

Comments
 (0)