Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
fix: add DefaultValue to addProperty method
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Oct 3, 2018
1 parent bc4ecd5 commit 8bff6cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { clone, equals, reject, mergeDeepRight } from 'ramda'
import { JsonProperties, JsonPropertyTypes, ObjectSchema } from './objects'
import { clone, equals, mergeDeepRight, reject } from 'ramda'
import {
DefaultValue,
JsonProperties,
JsonPropertyTypes,
ObjectSchema,
} from './objects'
import { normalizeRequiredProperties } from './utils'

//
Expand All @@ -19,6 +24,7 @@ type AddPropertyOptions = {
exampleValue: any
isRequired?: boolean
propertyDescription?: string
defaultValue?: DefaultValue
see?: string | ObjectSchema
}

Expand Down
6 changes: 4 additions & 2 deletions src/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export type JsonPropertyTypes =
| string[]
| number[]

export type DefaultValue = null | boolean | number | string

export type JsonProperty = {
type: JsonPropertyTypes
format?: string
Expand All @@ -61,9 +63,9 @@ export type JsonProperty = {
* An explicit default value if we fill an object to match schema.
* For now allows a limited set of primitive types
*
* @type {(null | boolean | number | string)}
* @type {DefaultValue}
*/
defaultValue?: null | boolean | number | string
defaultValue?: DefaultValue
}

export type JsonProperties = {
Expand Down

0 comments on commit 8bff6cf

Please sign in to comment.