geniespec 0.1.2.dev13__tar.gz → 0.1.2.dev15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/PKG-INFO +15 -1
  2. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/README.md +14 -0
  3. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/pyproject.toml +1 -1
  4. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/pyproject.toml.orig +1 -1
  5. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/api_schema.yaml +23 -7
  6. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/genie.py +32 -1
  7. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/languages.py +25 -9
  8. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/renderable_types.py +17 -3
  9. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/python-server/{service}/v{version}/api.py.j2 +0 -8
  10. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/typescript-client/{service}/v{version}/resources.ts.j2 +1 -0
  11. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/types.py +10 -4
  12. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/__init__.py +0 -0
  13. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/cli.py +0 -0
  14. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/python-server/{service}/__init__.py.j2 +0 -0
  15. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/python-server/{service}/v{version}/__init__.py.j2 +0 -0
  16. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/python-server/{service}/v{version}/endpoints.py.j2 +0 -0
  17. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/python-server/{service}/v{version}/exceptions.py.j2 +0 -0
  18. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/python-server/{service}/v{version}/internal.py.j2 +0 -0
  19. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/python-server/{service}/v{version}/resources.py.j2 +0 -0
  20. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/typescript-client/{service}/v{version}/client.ts.j2 +0 -0
  21. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/typescript-client/{service}/v{version}/endpoints.ts.j2 +0 -0
  22. {geniespec-0.1.2.dev13 → geniespec-0.1.2.dev15}/src/geniespec/templates/typescript-client/{service}/v{version}/index.ts.j2 +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geniespec
3
- Version: 0.1.2.dev13
3
+ Version: 0.1.2.dev15
4
4
  Summary: Generate API code from an api.yaml spec
5
5
  License-Expression: MIT
6
6
  Requires-Dist: jinja2>=3.1.6
@@ -123,6 +123,20 @@ resources:
123
123
 
124
124
  Resources are addressed by their primary attribute. A `GET` transition also adds a lookup for each `isUnique` attribute (`/assets/address/{address}`), and, on a child resource, for each `isUniqueInParent` attribute: one that is only unique within its parent, like an asset's address on a chain. Those lookups only exist through the parent (`/chains/{chainId}/assets/address/{address}`), never from root or another ancestor. Lookups share the `GET` transition's documentation fields, with `By<Attribute>` added to its `operationId` (`getAsset` → `getAssetByAddress`).
125
125
 
126
+ ## Constraints
127
+
128
+ Attributes and request fields can set `minValue` and `maxValue` (number types), `minLength` and `maxLength` (`String` and `List`) and `pattern` (`String`). Requests that break them are rejected with a 400; a field that is left out isn't checked. On an attribute they apply wherever it's used: as a path id (`/chains/{chainId}`), in `CREATE` and `UPDATE` bodies and when the resource is nested in a request.
129
+
130
+ ```yaml
131
+ attributes:
132
+ - {name: chain-id, type: Integer, isPrimary: true, minValue: 1, maxValue: 2147483647}
133
+ requestFields:
134
+ - {name: rule-preset, type: String, pattern: '^[a-z]+$'}
135
+ - {name: cards, type: List, listValueTypes: [Card], minLength: 1, maxLength: 10}
136
+ ```
137
+
138
+ `python-server` writes them as pydantic constraints (`typing.Annotated[int, Field(ge=1, le=2147483647)]`), so they also show up in the OpenAPI schema.
139
+
126
140
  ## Overrides
127
141
 
128
142
  `overrides` keep an API that existed before genie working the same way once it moves to genie. They are meant to be dropped in the next major version of that API.
@@ -109,6 +109,20 @@ resources:
109
109
 
110
110
  Resources are addressed by their primary attribute. A `GET` transition also adds a lookup for each `isUnique` attribute (`/assets/address/{address}`), and, on a child resource, for each `isUniqueInParent` attribute: one that is only unique within its parent, like an asset's address on a chain. Those lookups only exist through the parent (`/chains/{chainId}/assets/address/{address}`), never from root or another ancestor. Lookups share the `GET` transition's documentation fields, with `By<Attribute>` added to its `operationId` (`getAsset` → `getAssetByAddress`).
111
111
 
112
+ ## Constraints
113
+
114
+ Attributes and request fields can set `minValue` and `maxValue` (number types), `minLength` and `maxLength` (`String` and `List`) and `pattern` (`String`). Requests that break them are rejected with a 400; a field that is left out isn't checked. On an attribute they apply wherever it's used: as a path id (`/chains/{chainId}`), in `CREATE` and `UPDATE` bodies and when the resource is nested in a request.
115
+
116
+ ```yaml
117
+ attributes:
118
+ - {name: chain-id, type: Integer, isPrimary: true, minValue: 1, maxValue: 2147483647}
119
+ requestFields:
120
+ - {name: rule-preset, type: String, pattern: '^[a-z]+$'}
121
+ - {name: cards, type: List, listValueTypes: [Card], minLength: 1, maxLength: 10}
122
+ ```
123
+
124
+ `python-server` writes them as pydantic constraints (`typing.Annotated[int, Field(ge=1, le=2147483647)]`), so they also show up in the OpenAPI schema.
125
+
112
126
  ## Overrides
113
127
 
114
128
  `overrides` keep an API that existed before genie working the same way once it moves to genie. They are meant to be dropped in the next major version of that API.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "geniespec"
3
- version = "0.1.2.dev13"
3
+ version = "0.1.2.dev15"
4
4
  description = "Generate API code from an api.yaml spec"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "geniespec"
3
- version = "0.1.2.dev13"
3
+ version = "0.1.2.dev15"
4
4
  description = "Generate API code from an api.yaml spec"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -182,6 +182,18 @@ definitions:
182
182
  pattern: '^[A-Z][A-Za-z-\[\]_, ]*$'
183
183
  enumValues:
184
184
  $ref: '#/definitions/EnumValues'
185
+ minValue:
186
+ type: number
187
+ maxValue:
188
+ type: number
189
+ minLength:
190
+ type: integer
191
+ minimum: 0
192
+ maxLength:
193
+ type: integer
194
+ minimum: 0
195
+ pattern:
196
+ type: string
185
197
  Resource:
186
198
  type: object
187
199
  additionalProperties: false
@@ -377,14 +389,18 @@ definitions:
377
389
  type: boolean
378
390
  description:
379
391
  type: string
380
- maxValue:
381
- type:
382
- - string
383
- - number
384
392
  minValue:
385
- type:
386
- - string
387
- - number
393
+ type: number
394
+ maxValue:
395
+ type: number
396
+ minLength:
397
+ type: integer
398
+ minimum: 0
399
+ maxLength:
400
+ type: integer
401
+ minimum: 0
402
+ pattern:
403
+ type: string
388
404
  source:
389
405
  type: string
390
406
  enum:
@@ -194,8 +194,11 @@ class Renderer:
194
194
  enumValues=requestField.enumValues,
195
195
  ),
196
196
  defaultValue=requestField.defaultValue,
197
- maxValue=requestField.maxValue,
198
197
  minValue=requestField.minValue,
198
+ maxValue=requestField.maxValue,
199
+ minLength=requestField.minLength,
200
+ maxLength=requestField.maxLength,
201
+ pattern=requestField.pattern,
199
202
  isRequired=requestField.isRequired,
200
203
  isDeprecated=requestField.isDeprecated,
201
204
  source=requestField.source,
@@ -240,6 +243,11 @@ class Renderer:
240
243
  isSettable=attribute.isSettable,
241
244
  isNullable=attribute.isNullable,
242
245
  description=attribute.description,
246
+ minValue=attribute.minValue,
247
+ maxValue=attribute.maxValue,
248
+ minLength=attribute.minLength,
249
+ maxLength=attribute.maxLength,
250
+ pattern=attribute.pattern,
243
251
  )
244
252
 
245
253
  def _attribute_to_renderable_parameter(self, attribute: Attribute, isRequired: bool, knownTypeNames: dict[str, str], shouldUseDefault: bool = True) -> RenderableParameter:
@@ -259,8 +267,28 @@ class Renderer:
259
267
  isRequired=isRequired,
260
268
  isDeprecated=attribute.isDeprecated,
261
269
  description=attribute.description,
270
+ minValue=attribute.minValue,
271
+ maxValue=attribute.maxValue,
272
+ minLength=attribute.minLength,
273
+ maxLength=attribute.maxLength,
274
+ pattern=attribute.pattern,
262
275
  )
263
276
 
277
+ @staticmethod
278
+ def _constraint_errors(owner: str, field: Attribute | RequestField) -> list[str]:
279
+ errors: list[str] = []
280
+ if (field.minValue is not None or field.maxValue is not None) and field.fieldType not in {PrimitiveTypes.INTEGER, PrimitiveTypes.LONG_INTEGER, PrimitiveTypes.FLOAT, PrimitiveTypes.DOUBLE, PrimitiveTypes.BIG_INT}:
281
+ errors.append(f'{field.name} on {owner}: minValue and maxValue need a number type, not {field.fieldType}')
282
+ if (field.minLength is not None or field.maxLength is not None) and field.fieldType not in {PrimitiveTypes.STRING, SpecialTypes.LIST}:
283
+ errors.append(f'{field.name} on {owner}: minLength and maxLength need a String or List type, not {field.fieldType}')
284
+ if field.pattern is not None and field.fieldType != PrimitiveTypes.STRING:
285
+ errors.append(f'{field.name} on {owner}: pattern needs a String type, not {field.fieldType}')
286
+ if field.minValue is not None and field.maxValue is not None and field.minValue > field.maxValue:
287
+ errors.append(f'{field.name} on {owner}: minValue is greater than maxValue')
288
+ if field.minLength is not None and field.maxLength is not None and field.minLength > field.maxLength:
289
+ errors.append(f'{field.name} on {owner}: minLength is greater than maxLength')
290
+ return errors
291
+
264
292
  @staticmethod
265
293
  def _operation_documentation(transition: BaseTransition) -> dict[str, object]:
266
294
  return {'operationId': transition.operationId, 'summary': transition.summary, 'description': transition.description, 'tags': transition.tags, 'extensions': transition.extensions}
@@ -472,6 +500,9 @@ class Renderer:
472
500
  expectedPrimaryName = f'{RenderableString.from_pascal_case_string(string=fullName).kebabCaseString}-id'
473
501
  if resource.transitions and resource.primaryAttribute is not None and not isOneToOne and resource.primaryAttribute.name != expectedPrimaryName:
474
502
  resourceErrors.append(f'Primary attribute of {fullName} must be {expectedPrimaryName}, found {resource.primaryAttribute.name}')
503
+ resourceErrors += [error for attribute in resource.attributes for error in self._constraint_errors(owner=fullName, field=attribute)]
504
+ resourceErrors += [error for transition in resource.transitions for requestField in transition.requestFields for error in self._constraint_errors(owner=f'{fullName} {transition.action}', field=requestField)]
505
+ resourceErrors += [error for transition in api.transitions for requestField in transition.requestFields for error in self._constraint_errors(owner=transition.action, field=requestField)]
475
506
  if resourceErrors:
476
507
  raise SemanticValidationException(message='\n'.join(resourceErrors))
477
508
  renderableOperations = [
@@ -408,7 +408,7 @@ class PythonLanguageDefinition(BaseLanguageDefinition):
408
408
  return self.snake_name(name=self._operation_name(operation=operation))
409
409
 
410
410
  def requires_parameter_preprocessing(self, operation: RenderableOperation, parameter: RenderableParameter) -> bool:
411
- return (parameter.defaultValue is not None and not self.is_undefined_parameter(operation=operation, parameter=parameter)) or parameter.minValue is not None or parameter.maxValue is not None
411
+ return parameter.defaultValue is not None and not self.is_undefined_parameter(operation=operation, parameter=parameter)
412
412
 
413
413
  def requires_undefined(self, api: RenderableApi) -> bool:
414
414
  return any(self.is_undefined_parameter(operation=operation, parameter=parameter) for operation in api.operations for parameter in operation.parameters)
@@ -417,9 +417,22 @@ class PythonLanguageDefinition(BaseLanguageDefinition):
417
417
  return any(not self.is_undefined_parameter(operation=operation, parameter=parameter) and not parameter.isRequired and not parameter.fieldType.isNullable for operation in api.operations for parameter in self.request_parameters(operation=operation))
418
418
 
419
419
  def endpoints_require_field(self, api: RenderableApi) -> bool:
420
- hasRequestDescriptions = any(parameter.description is not None for operation in api.operations for parameter in self.request_parameters(operation=operation))
420
+ hasRequestFieldArguments = any(parameter.description is not None or self._constraint_arguments(field=parameter) for operation in api.operations for parameter in self.request_parameters(operation=operation))
421
421
  hasResponseDescriptions = any(field.description is not None for operation in api.operations for field in operation.responseFields or [])
422
- return self.requires_optional_field_default(api=api) or hasRequestDescriptions or hasResponseDescriptions
422
+ return self.requires_optional_field_default(api=api) or hasRequestFieldArguments or hasResponseDescriptions
423
+
424
+ @staticmethod
425
+ def _constraint_arguments(field: RenderableField) -> list[str]:
426
+ constraints = {'ge': field.minValue, 'le': field.maxValue, 'min_length': field.minLength, 'max_length': field.maxLength, 'pattern': field.pattern}
427
+ return [f'{name}={value!r}' for name, value in constraints.items() if value is not None]
428
+
429
+ def _constrained_type(self, field: RenderableField, apiVersion: Version, fieldFunction: str = 'Field', isLocalReference: bool = False) -> str:
430
+ constraintArguments = self._constraint_arguments(field=field)
431
+ if not constraintArguments:
432
+ return self.type(renderableType=field.fieldType, apiVersion=apiVersion, isLocalReference=isLocalReference)
433
+ typeName = self.type(renderableType=field.fieldType.model_copy(update={'isNullable': False}), apiVersion=apiVersion, isLocalReference=isLocalReference)
434
+ constrainedTypeName = f'typing.Annotated[{typeName}, {fieldFunction}({", ".join(constraintArguments)})]'
435
+ return f'{constrainedTypeName} | None' if field.fieldType.isNullable else constrainedTypeName
423
436
 
424
437
  @staticmethod
425
438
  def _field_default(default: str | None, description: str | None, fieldFunction: str = 'Field', shouldUseField: bool = False) -> str:
@@ -429,7 +442,7 @@ class PythonLanguageDefinition(BaseLanguageDefinition):
429
442
  return f' = {fieldFunction}({", ".join(arguments)})'
430
443
 
431
444
  def request_field_declaration(self, operation: RenderableOperation, parameter: RenderableParameter, apiVersion: Version) -> str:
432
- typeName = self.type(renderableType=parameter.fieldType, apiVersion=apiVersion)
445
+ typeName = self._constrained_type(field=parameter, apiVersion=apiVersion)
433
446
  if self.is_undefined_parameter(operation=operation, parameter=parameter):
434
447
  return f'UpdateValue[{typeName}]{self._field_default(default="UNDEFINED", description=parameter.description)}'
435
448
  if parameter.isRequired:
@@ -442,7 +455,8 @@ class PythonLanguageDefinition(BaseLanguageDefinition):
442
455
  return f'{self.type(renderableType=field.fieldType, apiVersion=apiVersion)}{self._field_default(default=None, description=field.description)}'
443
456
 
444
457
  def attribute_declaration(self, attribute: RenderableAttribute, apiVersion: Version) -> str:
445
- return f'{self.type(renderableType=attribute.fieldType, apiVersion=apiVersion, isLocalReference=True)}{self._field_default(default=None, description=attribute.description, fieldFunction="pydantic.Field")}'
458
+ typeName = self._constrained_type(field=attribute, apiVersion=apiVersion, fieldFunction='pydantic.Field', isLocalReference=True)
459
+ return f'{typeName}{self._field_default(default=None, description=attribute.description, fieldFunction="pydantic.Field")}'
446
460
 
447
461
  @staticmethod
448
462
  def route_documentation_arguments(operation: RenderableOperation) -> str:
@@ -502,18 +516,20 @@ class PythonLanguageDefinition(BaseLanguageDefinition):
502
516
 
503
517
  def resources_require_typing(self, api: RenderableApi) -> bool:
504
518
  hasInlineEnums = any(self.is_inline_enum(renderableType=attribute.fieldType) for resource in api.resources for attribute in resource.attributes)
505
- return len(api.enums) > 0 or len(api.oneOfs) > 0 or hasInlineEnums or self.requires_big_int(api=api)
519
+ hasConstraints = any(self._constraint_arguments(field=attribute) for resource in api.resources for attribute in resource.attributes)
520
+ return len(api.enums) > 0 or len(api.oneOfs) > 0 or hasInlineEnums or hasConstraints or self.requires_big_int(api=api)
506
521
 
507
522
  def resources_require_pydantic(self, api: RenderableApi) -> bool:
508
- hasDescriptions = any(attribute.description is not None for resource in api.resources for attribute in resource.attributes)
509
- return len(api.oneOfs) > 0 or hasDescriptions or self.module_requires(api=api, module='resources', requirement='json') or self.requires_big_int(api=api)
523
+ hasFieldArguments = any(attribute.description is not None or self._constraint_arguments(field=attribute) for resource in api.resources for attribute in resource.attributes)
524
+ return len(api.oneOfs) > 0 or hasFieldArguments or self.module_requires(api=api, module='resources', requirement='json') or self.requires_big_int(api=api)
510
525
 
511
526
  def one_of_alias(self, oneOf: RenderableOneOf, apiVersion: Version) -> str:
512
527
  return f'typing.Annotated[{" | ".join(self.one_of_member_class_names(oneOf=oneOf, apiVersion=apiVersion))}, pydantic.Field(discriminator={self.identifier(name=oneOf.discriminator)!r})]'
513
528
 
514
529
  def operations_require_typing(self, api: RenderableApi) -> bool:
515
530
  fieldTypes = [parameter.fieldType for operation in api.operations for parameter in operation.parameters] + [field.fieldType for operation in api.operations for field in operation.responseFields or []]
516
- return any(self.is_inline_enum(renderableType=fieldType) for fieldType in fieldTypes)
531
+ hasConstraints = any(self._constraint_arguments(field=parameter) for operation in api.operations for parameter in self.request_parameters(operation=operation))
532
+ return any(self.is_inline_enum(renderableType=fieldType) for fieldType in fieldTypes) or hasConstraints
517
533
 
518
534
  def requires_uploaded_file(self, api: RenderableApi) -> bool:
519
535
  return any(self.is_file_operation(operation=operation) for operation in api.operations)
@@ -130,6 +130,11 @@ class RenderableField(BaseModel):
130
130
  fieldType: RenderableType
131
131
  defaultValue: str | int | float | bool | None = None
132
132
  description: str | None = None
133
+ minValue: int | float | None = None
134
+ maxValue: int | float | None = None
135
+ minLength: int | None = None
136
+ maxLength: int | None = None
137
+ pattern: str | None = None
133
138
 
134
139
 
135
140
  class RenderableAttribute(RenderableField):
@@ -194,15 +199,24 @@ class RenderableEndpoint(BaseModel):
194
199
  @property
195
200
  def urlParameters(self) -> list[RenderableParameter]: # noqa: N802
196
201
  return [
197
- RenderableParameter(name=component.attribute.name, fieldType=component.attribute.fieldType, isRequired=True, isDeprecated=False, description=component.attribute.description)
202
+ RenderableParameter(
203
+ name=component.attribute.name,
204
+ fieldType=component.attribute.fieldType,
205
+ isRequired=True,
206
+ isDeprecated=False,
207
+ description=component.attribute.description,
208
+ minValue=component.attribute.minValue,
209
+ maxValue=component.attribute.maxValue,
210
+ minLength=component.attribute.minLength,
211
+ maxLength=component.attribute.maxLength,
212
+ pattern=component.attribute.pattern,
213
+ )
198
214
  for component in self.components
199
215
  if isinstance(component, ResourceEndpointComponent) and component.attribute is not None
200
216
  ]
201
217
 
202
218
 
203
219
  class RenderableParameter(RenderableField):
204
- maxValue: float | int | bool | str | None = None
205
- minValue: float | int | bool | str | None = None
206
220
  isRequired: bool = False
207
221
  isDeprecated: bool = False
208
222
  source: str = FieldSources.REQUEST
@@ -41,16 +41,8 @@ def create_routes(internal: {{ target.internal_class_name(api=api) }}, {% if tar
41
41
  {% set param_name = target.identifier(name=parameter.name) %}
42
42
  {% if target.requires_parameter_preprocessing(operation=operation, parameter=parameter) %}
43
43
  {{ param_name }} = request.data.{{ param_name }}
44
- {% if parameter.defaultValue is not none and not target.is_undefined_parameter(operation=operation, parameter=parameter) %}
45
44
  {{ param_name }} = {{ param_name }} if {{ param_name }} is not None else {{ target.literal(value=parameter.defaultValue) }}
46
45
  {% endif %}
47
- {% if parameter.minValue is not none %}
48
- {{ param_name }} = max({{ param_name }}, {{ target.literal(value=parameter.minValue) }}){% if parameter.fieldType.isNullable and parameter.defaultValue is none %} if {{ param_name }} is not None else None{% endif +%}
49
- {% endif %}
50
- {% if parameter.maxValue is not none %}
51
- {{ param_name }} = min({{ param_name }}, {{ target.literal(value=parameter.maxValue) }}){% if parameter.fieldType.isNullable and parameter.defaultValue is none %} if {{ param_name }} is not None else None{% endif +%}
52
- {% endif %}
53
- {% endif %}
54
46
  {% endfor %}
55
47
  {% if target.is_streaming(operation=operation) %}
56
48
  async for item in internal.{{ target.operation_name(operation=operation) }}_v{{ api.version.major }}(
@@ -42,6 +42,7 @@ export class {{ className }} {
42
42
  return new {{ className }}();
43
43
  };
44
44
 
45
+ // eslint-disable-next-line class-methods-use-this
45
46
  public toObject = (): RawObject => {
46
47
  return {};
47
48
  };
@@ -69,7 +69,15 @@ class ApiOneOf(BaseModel):
69
69
  types: list[str]
70
70
 
71
71
 
72
- class Attribute(BaseModel):
72
+ class FieldConstraints(BaseModel):
73
+ minValue: int | float | None = None
74
+ maxValue: int | float | None = None
75
+ minLength: int | None = None
76
+ maxLength: int | None = None
77
+ pattern: str | None = None
78
+
79
+
80
+ class Attribute(FieldConstraints):
73
81
  name: str
74
82
  fieldType: str = pydantic.Field(alias='type')
75
83
  listValueTypes: list[str] = []
@@ -102,7 +110,7 @@ class ResponseField(BaseModel):
102
110
  description: str | None = None
103
111
 
104
112
 
105
- class RequestField(BaseModel):
113
+ class RequestField(FieldConstraints):
106
114
  name: str
107
115
  fieldType: str = pydantic.Field(alias='type')
108
116
  listValueTypes: list[str] = []
@@ -112,8 +120,6 @@ class RequestField(BaseModel):
112
120
  isRequired: bool = False
113
121
  isDeprecated: bool = False
114
122
  defaultValue: str | int | float | bool | None = None
115
- maxValue: str | int | float | None = None
116
- minValue: str | int | float | None = None
117
123
  source: str = FieldSources.REQUEST
118
124
  description: str | None = None
119
125