Add writeOnly logic
This commit is contained in:
@@ -96,7 +96,7 @@ export const inferSchema = (thing) => {
|
||||
export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
let objectifySchema = objectify(schema)
|
||||
let { type, properties, additionalProperties, items, example } = objectifySchema
|
||||
let { includeReadOnly } = config
|
||||
let { includeReadOnly, includeWriteOnly } = config
|
||||
let defaultValue = objectifySchema.default
|
||||
let res = {}
|
||||
let _attr = {}
|
||||
@@ -177,7 +177,13 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
example = example || {}
|
||||
|
||||
for (let propName in props) {
|
||||
if ( !props[propName].readOnly || includeReadOnly ) {
|
||||
if ( props[propName].readOnly && !includeReadOnly ) {
|
||||
continue
|
||||
}
|
||||
if ( props[propName].writeOnly && !includeWriteOnly ) {
|
||||
continue
|
||||
}
|
||||
|
||||
props[propName].xml = props[propName].xml || {}
|
||||
|
||||
if (props[propName].xml.attribute) {
|
||||
@@ -199,7 +205,6 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalProperties === true) {
|
||||
res[displayName].push({additionalProp: "Anything can be here"})
|
||||
|
||||
Reference in New Issue
Block a user