Skip to content

Commit

Permalink
Removed omitempty from some of the struct fields (#187)
Browse files Browse the repository at this point in the history
* Removed 'omitempty' from some of the struct fields
  • Loading branch information
bogdanprodan-okta authored Nov 18, 2020
1 parent 3d98f0e commit c0ad1dd
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
4 changes: 2 additions & 2 deletions okta/oktaSignOnPolicyRuleSignonSessionActions.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions okta/passwordPolicyPasswordSettingsComplexity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion okta/passwordPolicyRecoveryEmailRecoveryToken.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions openapi/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,27 @@ function buildModelProperties(model) {
}

for (let propKey in properties) {
finalProps.push( structProp(properties[propKey].propertyName) + " " + getType(properties[propKey], "*") + " `json:\""+properties[propKey].propertyName+",omitempty\"`" );

finalProps.push( structProp(properties[propKey].propertyName) + " " +
getType(properties[propKey], "*") + createJsonTag(properties[propKey].propertyName));
}

return finalProps.join("\n\t");
}

function createJsonTag(propertyName) {
if (propertyName === "tokenLifetimeMinutes" ||
propertyName === "minLowerCase" ||
propertyName === "minUpperCase" ||
propertyName === "minNumber" ||
propertyName === "minSymbol" ||
propertyName === "maxSessionLifetimeMinutes" ||
propertyName === "maxSessionIdleMinutes") {
return " `json:\""+propertyName+"\"`"
} else {
return " `json:\""+propertyName+",omitempty\"`"
}
}

function isInstance(model) {
if ( model.modelName == "Csr" ||
model.modelName == "CsrMetadata" ||
Expand Down
6 changes: 3 additions & 3 deletions openapi/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ swagger-parser@^8.0.4:
z-schema "^4.2.2"

uglify-js@^3.1.4:
version "3.11.5"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.11.5.tgz#d6788bc83cf35ff18ea78a65763e480803409bc6"
integrity sha512-btvv/baMqe7HxP7zJSF7Uc16h1mSfuuSplT0/qdjxseesDU+yYzH33eHBH+eMdeRXwujXspaCTooWHQVVBh09w==
version "3.11.6"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.11.6.tgz#144b50d3e05eadd3ad4dd047c60ca541a8cd4e9c"
integrity sha512-oASI1FOJ7BBFkSCNDZ446EgkSuHkOZBuqRFrwXIKWCoXw8ZXQETooTQjkAcBS03Acab7ubCKsXnwuV2svy061g==

universalify@^0.1.0:
version "0.1.2"
Expand Down

0 comments on commit c0ad1dd

Please sign in to comment.