GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docspring-python/docspring/models/field_input.py at main · DocSpring/docspring-python

Expand file tree

/

field_input.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
431 lines (380 loc) · 40.9 KB
/

field_input.py

Copy path

File metadata and controls

431 lines (380 loc) · 40.9 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# coding: utf-8
"""
DocSpring API
Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
The version of the OpenAPI document: v2
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from docspring.models.barcode_symbology import BarcodeSymbology
from docspring.models.check_character import CheckCharacter
from docspring.models.combined_field_type import CombinedFieldType
from docspring.models.field_dependency_input import FieldDependencyInput
from docspring.models.field_display_type import FieldDisplayType
from docspring.models.field_type import FieldType
from docspring.models.image_gravity import ImageGravity
from docspring.models.image_scale_type import ImageScaleType
from docspring.models.number_condition_type import NumberConditionType
from docspring.models.shape_type import ShapeType
from docspring.models.string_condition_type import StringConditionType
from docspring.models.text_alignment import TextAlignment
from docspring.models.text_overflow import TextOverflow
from docspring.models.text_vertical_alignment import TextVerticalAlignment
from docspring.models.typeface import Typeface
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python
class FieldInput(BaseModel):
"""
A field of a template: the name of a value in submission data, and how and where it prints. Fields with the same `name` share one value and the settings the descriptions say are shared. A PDF template's fields are placed on its pages: `x`, `y`, `width` and `height` are in units where every page is 2480 wide, measured from the top-left corner of the field's `page`. To convert from PDF points, multiply by 2480 and divide by the page's width in points (`document.page_dimensions` on the template). An HTML or Word template's fields are all on page 1, and their placement and style settings aren't used: its HTML or Word document places and styles each value.
""" # noqa: E501
name: Optional[StrictStr] = Field(default=None, description="The field's name, the key of its value in submission data. A `/` nests the key in objects and arrays (`client/address`, `items/0/price`); write a literal `/` as `~1` and `~` as `~0`. Fields with the same name share one value and their shared settings, and array indexes inside a name are ignored for settings, so `items/0/price` and `items/1/price` share settings but not values. A `#` and a line number (`notes#0`, `notes#1`) splits one value over several fields as lines of text, and names that start with `@@` print submission details such as `@@date`.")
page: Optional[StrictInt] = Field(default=None, description="The number of the page the field is on, starting at 1. A field added without one goes on page 1, and a field moved to another page without a new `y` keeps its place on the page.")
type: Optional[FieldType] = Field(default=None, description="The data type of the field's value: `string`, `number`, `boolean`, `date`, `address`, `country`, `email`, `url`, `image`, `signature`, `initials`, `barcode`, or `combined` (made from other fields' values, never sent in submission data). It sets how the value is validated and which `display_type`s the field can use. `object` and `array` are the types of field groups (the template's `field_groups`), not of fields. Shared by every field with the same `name`.")
static: Optional[StrictBool] = Field(default=None, description="The field prints fixed content, its `default`, instead of a value from submission data, and it's left out of the template's data schema and forms. Static check marks and shapes always print unless `hidden`, and a static number field's `default` can be a formula. Shared by every field with the same `name`.")
editable: Optional[StrictBool] = Field(default=None, description="Text and check display only: prints the field as a fillable PDF form field instead of flat content (a text field with an `option_list` becomes a dropdown). A submission's `editable` option, when set, overrides this for every field. Shared by every field with the same `name`.")
default: Optional[StrictStr] = Field(default=None, description="The value used when a submission leaves the field out, and the value forms are pre-filled with. A required field still needs a value in each submission. An image field's default is an image URL, a number field's can be a formula, and a static field's is the content it prints. Shared by every field with the same `name`.")
title: Optional[StrictStr] = Field(default=None, description="The field's title in the template's data schema and on forms. When it's empty, a title is made from the field's name. Shared by every field with the same `name`.")
description: Optional[StrictStr] = Field(default=None, description="Help text for the field, added to the template's data schema and shown on forms. Shared by every field with the same `name`.")
placeholder: Optional[StrictStr] = Field(default=None, description="Placeholder text for the field's input on forms, added to the template's data schema as `x-placeholder`. Shared by every field with the same `name`.")
metadata: Optional[StrictStr] = Field(default=None, description="Text for your own use, added to the template's data schema as `x-metadata`. DocSpring doesn't use it. Shared by every field with the same `name`.")
required: Optional[StrictBool] = Field(default=None, description="Whether each submission must include a value for the field. A submission without one fails validation, and no PDF is generated. Shared by every field with the same `name`.")
option_list: Optional[StrictStr] = Field(default=None, description="String fields only: a comma-separated list of the values the field accepts. It's added to the template's data schema as an `enum`, forms show it as a select list, and an `editable` field becomes a dropdown. Shared by every field with the same `name`.")
combined_field_names: Optional[StrictStr] = Field(default=None, description="Combined fields only: a comma-separated list of the names of the fields whose values are combined, in order. Shared by every field with the same `name`.")
combined_field_type: Optional[CombinedFieldType] = Field(default=None, description="Combined fields only: `separator` joins the values with `combined_field_separator`, and `format` puts them into `combined_field_format`. Shared by every field with the same `name`.")
combined_field_separator: Optional[StrictStr] = Field(default=None, description="Combined fields only: the text placed between the values when `combined_field_type` is `separator`. Empty values are skipped. Defaults to a space. Shared by every field with the same `name`.")
combined_field_format: Optional[StrictStr] = Field(default=None, description="Combined fields only: the text for `combined_field_type` `format`, where `$0`, `$1` and so on are replaced with the values of `combined_field_names` in order, such as `Full name: $0, Occupation: $1`. Shared by every field with the same `name`.")
integer: Optional[StrictBool] = Field(default=None, description="Number fields only: the value must be a whole number. Shared by every field with the same `name`.")
minimum: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number fields only: the smallest value allowed. Shared by every field with the same `name`.")
maximum: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number fields only: the largest value allowed. Shared by every field with the same `name`.")
exclusive_minimum: Optional[StrictBool] = Field(default=None, description="Number fields only: the value must be greater than `minimum`, not equal to it. Shared by every field with the same `name`.")
exclusive_maximum: Optional[StrictBool] = Field(default=None, description="Number fields only: the value must be less than `maximum`, not equal to it. Shared by every field with the same `name`.")
include_time: Optional[StrictBool] = Field(default=None, description="Date fields only: the value is a date and time (`YYYY-MM-DDThh:mm:ss.fffZ`) instead of a date (`YYYY-MM-DD`), and it prints with the template's date-time format unless `date_time_format` is set. Shared by every field with the same `name`.")
signature_allow_draw: Optional[StrictBool] = Field(default=None, description="Signature and initials fields only: lets signers draw their signature on forms and in data requests. Shared by every field with the same `name`.")
signature_allow_type: Optional[StrictBool] = Field(default=None, description="Signature and initials fields only: lets signers type their name and choose a script font instead of drawing, on forms and in data requests. Shared by every field with the same `name`.")
barcode_symbology: Optional[BarcodeSymbology] = Field(default=None, description="Barcode fields only: the barcode format, which the value must match. `code_128` and `pdf417` take any ASCII text; `code_39` and `code_93` take capital letters, digits, spaces and `- . $ / + %`; `code_25` takes digits; `ean_13` takes 12 digits, `ean_8` 7 digits and `upc_a` 11 digits (the check digit is added). Shared by every field with the same `name`.")
hidden: Optional[StrictBool] = Field(default=None, description="Leaves the field off the PDF. It stays in the template's data schema (marked `x-hidden`) and on forms, so other fields, such as combined fields, can use its value. A hidden static check mark or shape isn't printed.")
x: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The distance from the page's left edge to the field's left edge. Positions and sizes are in units where every page is 2480 wide: one unit is the page's width in points divided by 2480 (about 0.247 points on a US Letter page).")
y: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The distance from the top edge of the field's `page` down to the field's top edge, in the units of `x`. A page is 2480 times its height divided by its width units tall: about 3209 for US Letter and 3508 for A4.")
width: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The field's width, in the units of `x`. A check mark is sized to the field's width.")
height: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The field's height, in the units of `x`. The template editor keeps check marks, QR codes, and square and circle shapes square, with `height` equal to `width`.")
rotation: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Rotates the field clockwise by this many degrees, from -360 to 360 (negative turns it counterclockwise).")
display_type: Optional[FieldDisplayType] = Field(default=None, description="How the value appears on the PDF: `text`, `check` (a check mark), `shape`, `qrcode`, `barcode`, or `image` (image, signature and initials fields). Check marks and shapes print only when the value meets the field's `condition`, and the field's `type` limits which display types it can use.")
opacity: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The opacity of the field's content and background, from 0 (invisible) to 1. QR codes and barcodes always print at full opacity.")
date_time_format: Optional[StrictStr] = Field(default=None, description="Date fields only: how the date prints, as a strftime format such as `%m/%d/%Y`, or a calculation such as `@years_since`, `@years_until` or `@diff_years` (also months, weeks, days, hours, minutes and seconds), counted to when the PDF is generated. Empty uses the template's date format, or its date-time format with `include_time`.")
typeface: Optional[Typeface] = Field(default=None, description="Text display only: the font, one of `Helvetica`, `Arial`, `Calibri`, `Open Sans`, `Roboto`, `Lato`, `Poppins`, `Public Sans`, `Questrial`, `Times New Roman`, `Dancing Script`, `Lovtony Script`, or the monospace `Courier`, `Inconsolata`, `Menlo`, `Roboto Mono` and `Ubuntu Mono`. Empty uses the template's default typeface.")
font_size: Optional[StrictInt] = Field(default=None, description="Text display only: the font size in points. Empty uses the template's default font size.")
character_spacing: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Text display only: extra space between characters, in points. Empty uses the template's default.")
bold: Optional[StrictBool] = Field(default=None, description="Text display only: prints the text in bold.")
uppercase: Optional[StrictBool] = Field(default=None, description="Text display only: prints the text in capital letters.")
strikethrough: Optional[StrictBool] = Field(default=None, description="Text display only: draws a line through the text.")
keep_leading_spaces: Optional[StrictBool] = Field(default=None, description="Text display only: keeps the spaces at the start of the text and of each line, so text can be lined up with spaces.")
overflow: Optional[TextOverflow] = Field(default=None, description="Text display only: what happens to text that doesn't fit the field. `shrink_to_fit` makes the font smaller, down to 5 points; `truncate` cuts the text off and returns the rest in the submission's `truncated_text`.")
multiline: Optional[StrictBool] = Field(default=None, description="Text display only: wraps the text over as many lines as fit in the field's height instead of printing one line, and forms show a multi-line input.")
multiline_lines: Optional[StrictInt] = Field(default=None, description="Text display only, with `multiline`: spreads the text over exactly this many evenly spaced lines in the field's height (up to 300), to line up with lines printed on the form. Empty uses the font's normal line spacing.")
min_length: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Text display only: the fewest characters the value can have, added to the template's data schema. Not used for date, address, country or number fields, or fields with an `option_list`.")
max_length: Optional[StrictInt] = Field(default=None, description="Text display only: the most characters the value can have, added to the template's data schema; it also limits an `editable` field. Not used for date, address, country or number fields, or fields with an `option_list`.")
auto_calculate_max_length: Optional[StrictBool] = Field(default=None, description="Text display only, with a monospace `typeface` (`Courier`, `Inconsolata`, `Menlo`, `Roboto Mono` or `Ubuntu Mono`): adds the number of characters that fit in the field to the template's data schema as its maximum length.")
color: Optional[StrictStr] = Field(default=None, description="Text display only: the text color, as a hex code such as `444444`. Empty uses the template's default text color.")
color_field_name: Optional[StrictStr] = Field(default=None, description="Text display only: the name of a data field whose value, a hex code such as `FF0000`, sets the text color for each submission. That field is added to the template's data schema, with `color` as its default.")
color_field_required: Optional[StrictBool] = Field(default=None, description="Makes the `color_field_name` field required. When it isn't required and a submission leaves it out, `color` is used.")
background_color: Optional[StrictStr] = Field(default=None, description="Text and check display only: a color that fills the field's area behind its content, as a hex code, to cover what the page shows there. Check fields print it even when unchecked; text fields print it only when they have a value.")
background_color_field_name: Optional[StrictStr] = Field(default=None, description="Text and check display only: the name of a data field whose value, a hex code, sets the background color for each submission. That field is added to the template's data schema, with `background_color` as its default.")
background_color_field_required: Optional[StrictBool] = Field(default=None, description="Makes the `background_color_field_name` field required. When it isn't required and a submission leaves it out, `background_color` is used.")
alignment: Optional[TextAlignment] = Field(default=None, description="Text display only: how the text is aligned across the field: `left`, `center`, `right` or `justify` (both edges of every line of multiline text except the last of each paragraph).")
v_alignment: Optional[TextVerticalAlignment] = Field(default=None, description="Text display only: how the text is aligned vertically in the field: `bottom`, `center` or `top`.")
comb: Optional[StrictBool] = Field(default=None, description="Text display only: splits the field into `comb_number_of_cells` boxes of equal width and prints one character, centered, in each.")
comb_number_of_cells: Optional[StrictInt] = Field(default=None, description="With `comb`: how many boxes the field has. The value's maximum length in the template's data schema is this plus `comb_value_offset`.")
comb_value_offset: Optional[StrictInt] = Field(default=None, description="With `comb`: the position, from 0, of the first character of the value that this field prints. For an SSN printed in boxes of 3, 2 and 4 digits, three fields named `ssn` use offsets 0, 3 and 5.")
shape_type: Optional[ShapeType] = Field(default=None, description="Shape display only: `square`, `rectangle`, `circle`, `ellipse`, `triangle` or `polygon`. A square or circle uses the smaller of `width` and `height`.")
shape_sides: Optional[StrictInt] = Field(default=None, description="Shape display only, with `shape_type` `polygon`: the number of sides, 3 to 12.")
shape_border_width: Optional[StrictInt] = Field(default=None, description="Shape display only: the width of the shape's border, in points.")
shape_border_color: Optional[StrictStr] = Field(default=None, description="Shape display only: the shape's border color, as a hex code. Null draws no border.")
shape_border_color_field_name: Optional[StrictStr] = Field(default=None, description="Shape display only: the name of a data field whose value, a hex code, sets the border color for each submission. That field is added to the template's data schema, with `shape_border_color` as its default.")
shape_border_color_field_required: Optional[StrictBool] = Field(default=None, description="Makes the `shape_border_color_field_name` field required. When it isn't required and a submission leaves it out, `shape_border_color` is used.")
shape_fill_color: Optional[StrictStr] = Field(default=None, description="Shape display only: the color that fills the shape, as a hex code. Null leaves it unfilled.")
shape_fill_color_field_name: Optional[StrictStr] = Field(default=None, description="Shape display only: the name of a data field whose value, a hex code, sets the fill color for each submission. That field is added to the template's data schema, with `shape_fill_color` as its default.")
shape_fill_color_field_required: Optional[StrictBool] = Field(default=None, description="Makes the `shape_fill_color_field_name` field required. When it isn't required and a submission leaves it out, `shape_fill_color` is used.")
check_character: Optional[CheckCharacter] = Field(default=None, description="Check display only: the character printed, as an HTML entity: `✓` (✓), `✔` (✔, the default), `✖` (✖), `✗` (✗) or `✘` (✘).")
check_color: Optional[StrictStr] = Field(default=None, description="Check display only: the check mark's color, as a hex code. Empty uses the template's default check color.")
check_color_field_name: Optional[StrictStr] = Field(default=None, description="Check display only: the name of a data field whose value, a hex code, sets the check mark's color for each submission. That field is added to the template's data schema, with `check_color` as its default.")
check_color_field_required: Optional[StrictBool] = Field(default=None, description="Makes the `check_color_field_name` field required. When it isn't required and a submission leaves it out, `check_color` is used.")
qrcode_color: Optional[StrictStr] = Field(default=None, description="QR code display only: the QR code's color, as a hex code, printed on a white background. Empty prints it in black.")
qrcode_color_field_name: Optional[StrictStr] = Field(default=None, description="QR code display only: the name of a data field whose value, a hex code, sets the QR code's color for each submission. That field is added to the template's data schema, with `qrcode_color` as its default.")
qrcode_color_field_required: Optional[StrictBool] = Field(default=None, description="Makes the `qrcode_color_field_name` field required. When it isn't required and a submission leaves it out, `qrcode_color` is used.")
true_text: Optional[StrictStr] = Field(default=None, description="Boolean fields with text display: the text printed when the value is `true`. Empty uses the template's `true_text`; when neither is set, nothing prints.")
false_text: Optional[StrictStr] = Field(default=None, description="Boolean fields with text display: the text printed when the value is `false`. Empty uses the template's `false_text`; when neither is set, nothing prints.")
condition: Optional[StrictStr] = Field(default=None, description="Check and shape display only: the value a string or number field's value is compared with, by `string_condition_type` or `number_condition_type`, to decide whether the check mark or shape prints. Boolean fields print when `true` (see `invert_boolean_condition`), and other types print when they have a value.")
string_condition_type: Optional[StringConditionType] = Field(default=None, description="String fields with check or shape display: how the value is compared with `condition`: `equals`, `contains`, `starts_with`, `ends_with`, or `regex`, where `condition` is a regular expression (RE2 syntax) the value must match; each has a `not_` form that prints when it doesn't match (`not_equals`, `not_regex`, ...). `blank` prints when the value is empty or only spaces and line breaks, and `not_blank` when it isn't; they ignore `condition`.")
number_condition_type: Optional[NumberConditionType] = Field(default=None, description="Number fields with check or shape display: how the value is compared with `condition`: `equals`, `gt` (greater than), `gte` (greater than or equal to), `lt` (less than), `lte` (less than or equal to), or `range`, between `number_condition_range_min` and `number_condition_range_max`.")
number_condition_range_min: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="With `number_condition_type` `range`: the lower end of the range, included unless `number_condition_range_exclusive_min` is set.")
number_condition_range_max: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="With `number_condition_type` `range`: the upper end of the range, included unless `number_condition_range_exclusive_max` is set.")
number_condition_range_exclusive_min: Optional[StrictBool] = Field(default=None, description="With `number_condition_type` `range`: leaves `number_condition_range_min` itself out of the range.")
number_condition_range_exclusive_max: Optional[StrictBool] = Field(default=None, description="With `number_condition_type` `range`: leaves `number_condition_range_max` itself out of the range.")
invert_boolean_condition: Optional[StrictBool] = Field(default=None, description="Boolean fields with check or shape display: prints the check mark or shape when the value is `false` or missing, instead of `true`.")
currency: Optional[StrictBool] = Field(default=None, description="Number fields only: forms show a currency input, and the template's data schema gives the field `format: currency`. It doesn't change how the number prints.")
decimal_places: Optional[StrictInt] = Field(default=None, description="Number fields with text display: prints the number with this many decimal places, from 0 (rounds to a whole number) to 99. Empty prints the number as it was sent.")
image_scale_type: Optional[ImageScaleType] = Field(default=None, description="Image fields only: how the image is resized to the field. `fit` keeps its proportions and fits it inside the field, which can leave empty space; `fill` keeps its proportions and crops it to fill the field; `stretch` stretches it to the field's size. Signatures and initials always fit.")
image_gravity: Optional[ImageGravity] = Field(default=None, description="Image, signature and initials fields: where the image sits in the field with `fit`, or which part is kept with `fill`: `NorthWest` (top left), `North`, `NorthEast`, `West`, `Center`, `East`, `SouthWest`, `South` or `SouthEast` (bottom right). It also aligns typed signatures, and isn't used with `stretch`.")
dependencies: Optional[FieldDependencyInput] = Field(default=None, description="The field's own conditional logic rule: when other fields' values meet its conditions, the field is shown, made required, or both. Null when it has none. The template's rules (`field_dependencies`) can apply to the field too. Shared by every field with the same `name`.")
id: Optional[StrictInt] = Field(default=None, description="The field's ID. Required when updating a field. When adding one, leave it out for the next free ID.")
__properties: ClassVar[List[str]] = ["name", "page", "type", "static", "editable", "default", "title", "description", "placeholder", "metadata", "required", "option_list", "combined_field_names", "combined_field_type", "combined_field_separator", "combined_field_format", "integer", "minimum", "maximum", "exclusive_minimum", "exclusive_maximum", "include_time", "signature_allow_draw", "signature_allow_type", "barcode_symbology", "hidden", "x", "y", "width", "height", "rotation", "display_type", "opacity", "date_time_format", "typeface", "font_size", "character_spacing", "bold", "uppercase", "strikethrough", "keep_leading_spaces", "overflow", "multiline", "multiline_lines", "min_length", "max_length", "auto_calculate_max_length", "color", "color_field_name", "color_field_required", "background_color", "background_color_field_name", "background_color_field_required", "alignment", "v_alignment", "comb", "comb_number_of_cells", "comb_value_offset", "shape_type", "shape_sides", "shape_border_width", "shape_border_color", "shape_border_color_field_name", "shape_border_color_field_required", "shape_fill_color", "shape_fill_color_field_name", "shape_fill_color_field_required", "check_character", "check_color", "check_color_field_name", "check_color_field_required", "qrcode_color", "qrcode_color_field_name", "qrcode_color_field_required", "true_text", "false_text", "condition", "string_condition_type", "number_condition_type", "number_condition_range_min", "number_condition_range_max", "number_condition_range_exclusive_min", "number_condition_range_exclusive_max", "invert_boolean_condition", "currency", "decimal_places", "image_scale_type", "image_gravity", "dependencies", "id"]
model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
extra="forbid",
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(to_jsonable_python(self.to_dict()))
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of FieldInput from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of dependencies
if self.dependencies:
_dict['dependencies'] = self.dependencies.to_dict()
# set to None if name (nullable) is None
# and model_fields_set contains the field
if self.name is None and "name" in self.model_fields_set:
_dict['name'] = None
# set to None if default (nullable) is None
# and model_fields_set contains the field
if self.default is None and "default" in self.model_fields_set:
_dict['default'] = None
# set to None if option_list (nullable) is None
# and model_fields_set contains the field
if self.option_list is None and "option_list" in self.model_fields_set:
_dict['option_list'] = None
# set to None if minimum (nullable) is None
# and model_fields_set contains the field
if self.minimum is None and "minimum" in self.model_fields_set:
_dict['minimum'] = None
# set to None if maximum (nullable) is None
# and model_fields_set contains the field
if self.maximum is None and "maximum" in self.model_fields_set:
_dict['maximum'] = None
# set to None if include_time (nullable) is None
# and model_fields_set contains the field
if self.include_time is None and "include_time" in self.model_fields_set:
_dict['include_time'] = None
# set to None if date_time_format (nullable) is None
# and model_fields_set contains the field
if self.date_time_format is None and "date_time_format" in self.model_fields_set:
_dict['date_time_format'] = None
# set to None if typeface (nullable) is None
# and model_fields_set contains the field
if self.typeface is None and "typeface" in self.model_fields_set:
_dict['typeface'] = None
# set to None if font_size (nullable) is None
# and model_fields_set contains the field
if self.font_size is None and "font_size" in self.model_fields_set:
_dict['font_size'] = None
# set to None if multiline_lines (nullable) is None
# and model_fields_set contains the field
if self.multiline_lines is None and "multiline_lines" in self.model_fields_set:
_dict['multiline_lines'] = None
# set to None if max_length (nullable) is None
# and model_fields_set contains the field
if self.max_length is None and "max_length" in self.model_fields_set:
_dict['max_length'] = None
# set to None if color (nullable) is None
# and model_fields_set contains the field
if self.color is None and "color" in self.model_fields_set:
_dict['color'] = None
# set to None if color_field_name (nullable) is None
# and model_fields_set contains the field
if self.color_field_name is None and "color_field_name" in self.model_fields_set:
_dict['color_field_name'] = None
# set to None if background_color (nullable) is None
# and model_fields_set contains the field
if self.background_color is None and "background_color" in self.model_fields_set:
_dict['background_color'] = None
# set to None if background_color_field_name (nullable) is None
# and model_fields_set contains the field
if self.background_color_field_name is None and "background_color_field_name" in self.model_fields_set:
_dict['background_color_field_name'] = None
# set to None if shape_border_color_field_name (nullable) is None
# and model_fields_set contains the field
if self.shape_border_color_field_name is None and "shape_border_color_field_name" in self.model_fields_set:
_dict['shape_border_color_field_name'] = None
# set to None if shape_fill_color (nullable) is None
# and model_fields_set contains the field
if self.shape_fill_color is None and "shape_fill_color" in self.model_fields_set:
_dict['shape_fill_color'] = None
# set to None if shape_fill_color_field_name (nullable) is None
# and model_fields_set contains the field
if self.shape_fill_color_field_name is None and "shape_fill_color_field_name" in self.model_fields_set:
_dict['shape_fill_color_field_name'] = None
# set to None if check_color (nullable) is None
# and model_fields_set contains the field
if self.check_color is None and "check_color" in self.model_fields_set:
_dict['check_color'] = None
# set to None if check_color_field_name (nullable) is None
# and model_fields_set contains the field
if self.check_color_field_name is None and "check_color_field_name" in self.model_fields_set:
_dict['check_color_field_name'] = None
# set to None if qrcode_color (nullable) is None
# and model_fields_set contains the field
if self.qrcode_color is None and "qrcode_color" in self.model_fields_set:
_dict['qrcode_color'] = None
# set to None if qrcode_color_field_name (nullable) is None
# and model_fields_set contains the field
if self.qrcode_color_field_name is None and "qrcode_color_field_name" in self.model_fields_set:
_dict['qrcode_color_field_name'] = None
# set to None if true_text (nullable) is None
# and model_fields_set contains the field
if self.true_text is None and "true_text" in self.model_fields_set:
_dict['true_text'] = None
# set to None if false_text (nullable) is None
# and model_fields_set contains the field
if self.false_text is None and "false_text" in self.model_fields_set:
_dict['false_text'] = None
# set to None if condition (nullable) is None
# and model_fields_set contains the field
if self.condition is None and "condition" in self.model_fields_set:
_dict['condition'] = None
# set to None if number_condition_range_min (nullable) is None
# and model_fields_set contains the field
if self.number_condition_range_min is None and "number_condition_range_min" in self.model_fields_set:
_dict['number_condition_range_min'] = None
# set to None if number_condition_range_max (nullable) is None
# and model_fields_set contains the field
if self.number_condition_range_max is None and "number_condition_range_max" in self.model_fields_set:
_dict['number_condition_range_max'] = None
# set to None if decimal_places (nullable) is None
# and model_fields_set contains the field
if self.decimal_places is None and "decimal_places" in self.model_fields_set:
_dict['decimal_places'] = None
# set to None if dependencies (nullable) is None
# and model_fields_set contains the field
if self.dependencies is None and "dependencies" in self.model_fields_set:
_dict['dependencies'] = None
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of FieldInput from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj, context={"skip_enum_validation": True})
_obj = cls.model_validate({
"name": obj.get("name"),
"page": obj.get("page"),
"type": obj.get("type"),
"static": obj.get("static"),
"editable": obj.get("editable"),
"default": obj.get("default"),
"title": obj.get("title"),
"description": obj.get("description"),
"placeholder": obj.get("placeholder"),
"metadata": obj.get("metadata"),
"required": obj.get("required"),
"option_list": obj.get("option_list"),
"combined_field_names": obj.get("combined_field_names"),
"combined_field_type": obj.get("combined_field_type"),
"combined_field_separator": obj.get("combined_field_separator"),
"combined_field_format": obj.get("combined_field_format"),
"integer": obj.get("integer"),
"minimum": obj.get("minimum"),
"maximum": obj.get("maximum"),
"exclusive_minimum": obj.get("exclusive_minimum"),
"exclusive_maximum": obj.get("exclusive_maximum"),
"include_time": obj.get("include_time"),
"signature_allow_draw": obj.get("signature_allow_draw"),
"signature_allow_type": obj.get("signature_allow_type"),
"barcode_symbology": obj.get("barcode_symbology"),
"hidden": obj.get("hidden"),
"x": obj.get("x"),
"y": obj.get("y"),
"width": obj.get("width"),
"height": obj.get("height"),
"rotation": obj.get("rotation"),
"display_type": obj.get("display_type"),
"opacity": obj.get("opacity"),
"date_time_format": obj.get("date_time_format"),
"typeface": obj.get("typeface"),
"font_size": obj.get("font_size"),
"character_spacing": obj.get("character_spacing"),
"bold": obj.get("bold"),
"uppercase": obj.get("uppercase"),
"strikethrough": obj.get("strikethrough"),
"keep_leading_spaces": obj.get("keep_leading_spaces"),
"overflow": obj.get("overflow"),
"multiline": obj.get("multiline"),
"multiline_lines": obj.get("multiline_lines"),
"min_length": obj.get("min_length"),
"max_length": obj.get("max_length"),
"auto_calculate_max_length": obj.get("auto_calculate_max_length"),
"color": obj.get("color"),
"color_field_name": obj.get("color_field_name"),
"color_field_required": obj.get("color_field_required"),
"background_color": obj.get("background_color"),
"background_color_field_name": obj.get("background_color_field_name"),
"background_color_field_required": obj.get("background_color_field_required"),
"alignment": obj.get("alignment"),
"v_alignment": obj.get("v_alignment"),
"comb": obj.get("comb"),
"comb_number_of_cells": obj.get("comb_number_of_cells"),
"comb_value_offset": obj.get("comb_value_offset"),
"shape_type": obj.get("shape_type"),
"shape_sides": obj.get("shape_sides"),
"shape_border_width": obj.get("shape_border_width"),
"shape_border_color": obj.get("shape_border_color"),
"shape_border_color_field_name": obj.get("shape_border_color_field_name"),
"shape_border_color_field_required": obj.get("shape_border_color_field_required"),
"shape_fill_color": obj.get("shape_fill_color"),
"shape_fill_color_field_name": obj.get("shape_fill_color_field_name"),
"shape_fill_color_field_required": obj.get("shape_fill_color_field_required"),
"check_character": obj.get("check_character"),
"check_color": obj.get("check_color"),
"check_color_field_name": obj.get("check_color_field_name"),
"check_color_field_required": obj.get("check_color_field_required"),
"qrcode_color": obj.get("qrcode_color"),
"qrcode_color_field_name": obj.get("qrcode_color_field_name"),
"qrcode_color_field_required": obj.get("qrcode_color_field_required"),
"true_text": obj.get("true_text"),
"false_text": obj.get("false_text"),
"condition": obj.get("condition"),
"string_condition_type": obj.get("string_condition_type"),
"number_condition_type": obj.get("number_condition_type"),
"number_condition_range_min": obj.get("number_condition_range_min"),
"number_condition_range_max": obj.get("number_condition_range_max"),
"number_condition_range_exclusive_min": obj.get("number_condition_range_exclusive_min"),
"number_condition_range_exclusive_max": obj.get("number_condition_range_exclusive_max"),
"invert_boolean_condition": obj.get("invert_boolean_condition"),
"currency": obj.get("currency"),
"decimal_places": obj.get("decimal_places"),
"image_scale_type": obj.get("image_scale_type"),
"image_gravity": obj.get("image_gravity"),
"dependencies": FieldDependencyInput.from_dict(obj["dependencies"]) if obj.get("dependencies") is not None else None,
"id": obj.get("id")
}, context={"skip_enum_validation": True})
return _obj
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.