Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b6da05c4a | ||
|
|
067f51bf04 | ||
|
|
6abc50ce66 | ||
|
|
8e510b84f4 | ||
|
|
5789c8d17f | ||
|
|
973c1254a1 | ||
|
|
567154dcb9 | ||
|
|
f13db314ea | ||
|
|
e303ce4cf2 | ||
|
|
d97fc6c502 | ||
|
|
aa66d4b9e3 | ||
|
|
232d39e3fc | ||
|
|
6951c0e649 | ||
|
|
afabbcea46 |
@@ -41,6 +41,10 @@
|
|||||||
{
|
{
|
||||||
"expose": "less",
|
"expose": "less",
|
||||||
"src": "src/less"
|
"src": "src/less"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expose": "base",
|
||||||
|
"src": "npm:getbase/src/less/base"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -141,7 +141,9 @@ module.exports = function(rules, options) {
|
|||||||
"node_modules"
|
"node_modules"
|
||||||
],
|
],
|
||||||
extensions: [".web.js", ".js", ".jsx", ".json", ".less"],
|
extensions: [".web.js", ".js", ".jsx", ".json", ".less"],
|
||||||
alias: {}
|
alias: {
|
||||||
|
base: "getbase/src/less/base",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
devtool: specialOptions.sourcemaps ? "nosource-source-map" : false,
|
devtool: specialOptions.sourcemaps ? "nosource-source-map" : false,
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ export default class Models extends Component {
|
|||||||
const ModelWrapper = getComponent("ModelWrapper")
|
const ModelWrapper = getComponent("ModelWrapper")
|
||||||
const Collapse = getComponent("Collapse")
|
const Collapse = getComponent("Collapse")
|
||||||
const ModelCollapse = getComponent("ModelCollapse")
|
const ModelCollapse = getComponent("ModelCollapse")
|
||||||
const JumpToPath = getComponent("JumpToPath")
|
|
||||||
|
|
||||||
return <section className={ showModels ? "models is-open" : "models"}>
|
return <section className={ showModels ? "models is-open" : "models"}>
|
||||||
<h4 onClick={() => layoutActions.show("models", !showModels)}>
|
<h4 onClick={() => layoutActions.show("models", !showModels)}>
|
||||||
@@ -65,13 +64,11 @@ export default class Models extends Component {
|
|||||||
this.props.specActions.requestResolvedSubtree([...this.getSchemaBasePath(), name])
|
this.props.specActions.requestResolvedSubtree([...this.getSchemaBasePath(), name])
|
||||||
}
|
}
|
||||||
|
|
||||||
const specPath = Im.List([...specPathBase, name])
|
|
||||||
|
|
||||||
const content = <ModelWrapper name={ name }
|
const content = <ModelWrapper name={ name }
|
||||||
expandDepth={ defaultModelsExpandDepth }
|
expandDepth={ defaultModelsExpandDepth }
|
||||||
schema={ schema || Im.Map() }
|
schema={ schema || Im.Map() }
|
||||||
displayName={displayName}
|
displayName={displayName}
|
||||||
specPath={specPath}
|
specPath={Im.List([...specPathBase, name])}
|
||||||
getComponent={ getComponent }
|
getComponent={ getComponent }
|
||||||
specSelectors={ specSelectors }
|
specSelectors={ specSelectors }
|
||||||
getConfigs = {getConfigs}
|
getConfigs = {getConfigs}
|
||||||
@@ -85,7 +82,6 @@ export default class Models extends Component {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
return <div id={ `model-${name}` } className="model-container" key={ `models-section-${name}` }>
|
return <div id={ `model-${name}` } className="model-container" key={ `models-section-${name}` }>
|
||||||
<span className="models-jump-to-path"><JumpToPath specPath={specPath} /></span>
|
|
||||||
<ModelCollapse
|
<ModelCollapse
|
||||||
classes="model-box"
|
classes="model-box"
|
||||||
collapsedContent={this.getCollapsedContent(name)}
|
collapsedContent={this.getCollapsedContent(name)}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ export const sampleFromSchema = (schema, config={}) => {
|
|||||||
let { type, example, properties, additionalProperties, items } = objectify(schema)
|
let { type, example, properties, additionalProperties, items } = objectify(schema)
|
||||||
let { includeReadOnly, includeWriteOnly } = config
|
let { includeReadOnly, includeWriteOnly } = config
|
||||||
|
|
||||||
|
|
||||||
if(example !== undefined) {
|
if(example !== undefined) {
|
||||||
return deeplyStripKey(example, "$$ref", (val) => {
|
return deeplyStripKey(example, "$$ref", (val) => {
|
||||||
// do a couple of quick sanity tests to ensure the value
|
// do a couple of quick sanity tests to ensure the value
|
||||||
|
|||||||
+1
-1
@@ -742,7 +742,7 @@ export const getCommonExtensions = (defObj) => defObj.filter((v, k) => /^pattern
|
|||||||
// `predicate` can be used to discriminate the stripping further,
|
// `predicate` can be used to discriminate the stripping further,
|
||||||
// by preserving the key's place in the object based on its value.
|
// by preserving the key's place in the object based on its value.
|
||||||
export function deeplyStripKey(input, keyToStrip, predicate = () => true) {
|
export function deeplyStripKey(input, keyToStrip, predicate = () => true) {
|
||||||
if(typeof input !== "object" || Array.isArray(input) || input === null || !keyToStrip) {
|
if(typeof input !== "object" || Array.isArray(input) || !keyToStrip) {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ section.models
|
|||||||
.model-container
|
.model-container
|
||||||
{
|
{
|
||||||
margin: 0 20px 15px;
|
margin: 0 20px 15px;
|
||||||
position: relative;
|
|
||||||
|
|
||||||
transition: all .5s;
|
transition: all .5s;
|
||||||
|
|
||||||
@@ -187,13 +186,6 @@ section.models
|
|||||||
{
|
{
|
||||||
margin: 0 20px;
|
margin: 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.models-jump-to-path {
|
|
||||||
position: absolute;
|
|
||||||
top: 8px;
|
|
||||||
right: 5px;
|
|
||||||
opacity: 0.65;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-box
|
.model-box
|
||||||
|
|||||||
@@ -379,46 +379,6 @@ describe("sampleFromSchema", function() {
|
|||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns null for a null example", function() {
|
|
||||||
var definition = {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"foo": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true,
|
|
||||||
"example": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var expected = {
|
|
||||||
foo: null
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
|
||||||
})
|
|
||||||
|
|
||||||
it("returns null for a null object-level example", function() {
|
|
||||||
var definition = {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"foo": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"example": {
|
|
||||||
"foo": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var expected = {
|
|
||||||
foo: null
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user