Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Add code type for inputFields #439

Merged
merged 2 commits into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/schema/docs/build/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ Key | Required | Type | Description
`key` | **yes** | `string` | A unique machine readable key for this value (IE: "fname").
`label` | no | `string` | A human readable label for this value (IE: "First Name").
`helpText` | no | `string` | A human readable description of this value (IE: "The first part of a full name."). You can use Markdown.
`type` | no | `string` in (`'string'`, `'text'`, `'integer'`, `'number'`, `'boolean'`, `'datetime'`, `'file'`, `'password'`, `'copy'`) | The type of this value.
`type` | no | `string` in (`'string'`, `'text'`, `'integer'`, `'number'`, `'boolean'`, `'datetime'`, `'file'`, `'password'`, `'copy'`, `'code'`) | The type of this value. Use `string` for basic text input, `text` for a large, `<textarea>` style box, and `code` for a `<textarea>` with a fixed-width font.
`required` | no | `boolean` | If this value is required or not.
`placeholder` | no | `string` | An example value that is not saved.
`default` | no | `string` | A default value that is saved the first time a Zap is created.
Expand Down
5 changes: 3 additions & 2 deletions packages/schema/exported-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"maxLength": 1000
},
"type": {
"description": "The type of this value.",
"description": "The type of this value. Use `string` for basic text input, `text` for a large, `<textarea>` style box, and `code` for a `<textarea>` with a fixed-width font.",
"type": "string",
"enum": [
"string",
Expand All @@ -175,7 +175,8 @@
"datetime",
"file",
"password",
"copy"
"copy",
"code"
]
},
"required": {
Expand Down
9 changes: 5 additions & 4 deletions packages/schema/lib/schemas/FieldSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ const { INCOMPATIBLE_FIELD_SCHEMA_KEYS } = require('../constants');
// ... etc
const wrapInBackticks = (s) => `\`${s}\``;
const formatBullet = (f) => `* ${f.map(wrapInBackticks).join(' & ')}`;
const incompatibleFieldsList = INCOMPATIBLE_FIELD_SCHEMA_KEYS.map(
formatBullet
).join('\n');
const incompatibleFieldsList =
INCOMPATIBLE_FIELD_SCHEMA_KEYS.map(formatBullet).join('\n');

module.exports = makeSchema(
{
Expand Down Expand Up @@ -45,7 +44,8 @@ module.exports = makeSchema(
maxLength: 1000,
},
type: {
description: 'The type of this value.',
description:
'The type of this value. Use `string` for basic text input, `text` for a large, `<textarea>` style box, and `code` for a `<textarea>` with a fixed-width font.',
type: 'string',
// string == unicode
// text == a long textarea string
Expand All @@ -61,6 +61,7 @@ module.exports = makeSchema(
'file',
'password',
'copy',
'code',
],
},
required: {
Expand Down