Skip to content

Commit 7d233c7

Browse files
committed
Merge remote-tracking branch 'hackolade/master'
2 parents cffd35f + afabb7f commit 7d233c7

File tree

6 files changed

+132
-9
lines changed

6 files changed

+132
-9
lines changed

adapter/0.1.37.json

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/**
2+
* Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved.
3+
*
4+
* The copyright to the computer software herein is the property of IntegrIT S.A.
5+
* The software may be used and/or copied only with the written permission of
6+
* IntegrIT S.A. or in accordance with the terms and conditions stipulated in
7+
* the agreement/contract under which the software has been supplied.
8+
*
9+
* {
10+
* "add": {
11+
* "entity": [<names of new property>],
12+
* "container": [<names of new property>],
13+
* "model": [<names of new property>],
14+
* "view": [<names of new property>],
15+
* "field": {
16+
* "<type>": [<names of new property>]
17+
* }
18+
* },
19+
* "remove": {
20+
* "entity": [<names of new property>],
21+
* "container": [<names of new property>],
22+
* "model": [<names of new property>],
23+
* "view": [<names of new property>],
24+
* "field": {
25+
* "<type>": [<names of new property>]
26+
* }
27+
* },
28+
* "modify": {
29+
* "entity": [
30+
* {
31+
* "from": { <properties that identify record> },
32+
* "to": { <properties that need to be changed> }
33+
* }
34+
* ],
35+
* "container": [],
36+
* "model": [],
37+
* "view": [],
38+
* "field": []
39+
* },
40+
* }
41+
*/
42+
{
43+
"modify": {
44+
"field": [
45+
{
46+
"from": {
47+
"type": "integer",
48+
"format": "int64"
49+
},
50+
"to": {
51+
"mode": "int64"
52+
}
53+
},
54+
{
55+
"from": {
56+
"type": "integer",
57+
"format": "int32"
58+
},
59+
"to": {
60+
"mode": "int32"
61+
}
62+
},
63+
{
64+
"from": {
65+
"type": "number",
66+
"format": "float"
67+
},
68+
"to": {
69+
"mode": "float"
70+
}
71+
},
72+
{
73+
"from": {
74+
"type": "number",
75+
"format": "double"
76+
},
77+
"to": {
78+
"mode": "double"
79+
}
80+
}
81+
]
82+
},
83+
"delete": {
84+
"field": {
85+
"integer": [
86+
"format"
87+
],
88+
"number": [
89+
"format"
90+
]
91+
}
92+
}
93+
}

forward_engineering/helpers/validationHelper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ const createPathParameterError = (pathName, parameter) => {
102102
};
103103

104104
const checkPathParameters = (schema) => {
105+
const requestNames = ["get", "put", "post", "delete", "options", "head", "patch", "trace", "$ref"];
106+
105107
return Object.keys(schema.paths).reduce((errors, pathName) => {
106108
const pathParameters = getPathParameters(pathName);
107109
const requests = schema.paths[pathName] || {};
108110

109111
return pathParameters.reduce((errors, parameter) => {
110-
return Object.keys(requests).reduce((errors, requestName) => {
112+
return requestNames.filter(requestName => requests[requestName]).reduce((errors, requestName) => {
111113
const request = requests[requestName];
112114

113115
if (!Array.isArray(request.parameters)) {

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "OpenAPI",
3-
"version": "0.1.35",
4-
"versionDate": "2021-11-01",
3+
"version": "0.1.40",
4+
"versionDate": "2022-01-28",
55
"author": "hackolade",
66
"engines": {
77
"hackolade": "4.3.15",
@@ -19,7 +19,7 @@
1919
"nestedCollections": {
2020
"level": 1
2121
},
22-
"disableMultipleTypes": false,
22+
"disableMultipleTypes": true,
2323
"enableReverseEngineering": {
2424
"jsonDocument": {
2525
"entities": false,
@@ -75,7 +75,10 @@
7575
"enableStackedNestedCollections": true,
7676
"externalDefinitionsFromTargetSchema": true,
7777
"apiTarget": true,
78-
"FEScriptCommentsSupported": true
78+
"FEScriptCommentsSupported": true,
79+
"displayOptions": {
80+
"hideNonNullableAttributes": true
81+
}
7982
}
8083
},
8184
"description": "Hackolade plugin for OpenAPI",

properties_pane/field_level/fieldLevelConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ making sure that you maintain a proper JSON format.
639639
"schemaId",
640640
"type",
641641
{
642-
"propertyName": "format",
642+
"propertyName": "Format",
643643
"propertyKeyword": "mode",
644644
"propertyType": "select",
645645
"options": [

reverse_engineering/helpers/dataHelper.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,14 +564,27 @@ const setMissedType = (schema) => {
564564
return schema;
565565
}
566566

567+
const convertFormatToMode = schema => {
568+
switch (schema.type) {
569+
case 'number':
570+
case 'integer': {
571+
const { format, ...schemaData } = schema;
572+
573+
return { ...schemaData, mode: format };
574+
}
575+
default:
576+
return schema;
577+
}
578+
};
579+
567580
const handleSchemaProps = (schema, fieldOrder) => {
568581
if (!schema) {
569582
schema = {
570583
type: 'object'
571584
};
572585
}
573586

574-
const fixedSchema = setMissedType(schema);
587+
const fixedSchema = convertFormatToMode(setMissedType(schema));
575588
const schemaWithAdditionalPropertiesData = handleAdditionalProperties(fixedSchema);
576589
const schemaWithChoices = handleSchemaChoices(schemaWithAdditionalPropertiesData, fieldOrder);
577590
const reorderedSchema = commonHelper.reorderFields(schemaWithChoices, fieldOrder);
@@ -608,7 +621,7 @@ const handleDefinitionSchemaProps = (schema, fieldOrder) => {
608621
};
609622
}
610623

611-
const fixedSchema = setMissedType(schema);
624+
const fixedSchema = convertFormatToMode(setMissedType(schema));
612625
const schemaWithAdditionalPropertiesData = handleAdditionalProperties(fixedSchema);
613626
const reorderedSchema = commonHelper.reorderFields(schemaWithAdditionalPropertiesData, fieldOrder);
614627
const schemaWithHandledProperties = Object.keys(reorderedSchema).reduce((accumulator, property) => {

snippets/response.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@
1111
"type": "object",
1212
"properties": [{
1313
"name": "application/json",
14-
"type": "media"
14+
"type": "media",
15+
"properties": [{
16+
"name": "schema",
17+
"type": "object"
18+
}, {
19+
"name": "examples",
20+
"type": "object",
21+
"subtype": "example"
22+
}, {
23+
"name": "encoding",
24+
"type": "object",
25+
"subtype": "encoding"
26+
}]
1527
}]
1628
},{
1729
"name": "links",

0 commit comments

Comments
 (0)