How to use the runtypes.String function in runtypes

To help you get started, we’ve selected a few runtypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hmil / rest.ts / test / fixtures / testAPI.ts View on Github external
simplePatch: PATCH `/method/patch`

    simpleDelete: DELETE `/method/delete`

    noTemplateString: GET('/path/string')

    simpleQueryParams: GET `/query`
            'mandatory': rt.String,
            'union': rt.Union(rt.Literal('true'), rt.Literal('false')),
            'optional': rt.Union(rt.String, rt.Undefined)

    optionalQueryParams: GET `/query/optional`
            'maybeParam': '' as string | undefined

    simpleRequestBody: POST `/simpleBody`

    noRepsonseEndpoint: PUT `/noResponse`,

    pathParams: GET `/path/${'kind'}/id/${'id'}`
github citycide / trilogy / src / types.ts View on Github external
t.Dictionary(t.Union(t.String, t.Array(t.String)))

export const GroupClause = t.Union(

export const OrderClause = t.Union(
  t.Tuple(t.String, t.String)

export const TrilogyOptions = t.Partial({
  client: t.Union(t.Literal('sqlite3'), t.Literal('sql.js')),
  dir: t.String

export const ModelOptions = t.Partial({
  index: Index,
  primary: t.Array(t.String),
  unique: t.Array(t.String),
  timestamps: t.Boolean

export const AggregateOptions = t.Partial({
  distinct: t.Boolean,
  group: GroupClause,
  order: OrderClause

export const CreateOptions = t.Partial({