Money filters
MoneyRangeFilter
Section titled “MoneyRangeFilter”Filters by comparing a field to a range of monetary values.
Filter schema
Section titled “Filter schema”| Property | Type | Description |
|---|---|---|
| operator | RangeOperators | The operator to apply to the filter value |
| value | range object | The value to use for the filter operation |
Range object
Section titled “Range object”| Property | Type | Description |
|---|---|---|
| min | Money | The minimum monetary value for this range |
| max | Money | The maximum monetary value for this range |
Formats
Section titled “Formats”A JSON example of this model.
{ "operator": "between", "value": { "min": { "amount": "-100.5", "currency": "Sample string value" }, "max": { "amount": "-100.5", "currency": "Sample string value" } }}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: MoneyRangeFilter.yamltype: objectproperties: operator: $ref: RangeOperators.yaml description: The operator to apply to the filter value value: type: object properties: min: $ref: Money.yaml max: $ref: Money.yaml required: - min - max unevaluatedProperties: not: {} examples: - min: amount: "1000" currency: USD max: amount: "10000" currency: USD description: The value to use for the filter operationrequired: - operator - valueunevaluatedProperties: not: {}description: Filters by comparing a field to a range of monetary valuesThe TypeSpec code for this model.
/** Filters by comparing a field to a range of monetary values */model MoneyRangeFilter { /** The operator to apply to the filter value */ operator: RangeOperators;
/** The value to use for the filter operation */ @example(#{ min: #{ amount: "1000", currency: "USD" }, max: #{ amount: "10000", currency: "USD" }, }) value: { min: Fields.Money; max: Fields.Money; };}The Python code for this model.
class MoneyRangeFilter(CommonGrantsBaseModel): """Filter for money ranges using comparison operators."""
operator: RangeOperator = Field( ..., description="The operator to apply to the filter value", ) value: MoneyRange = Field(..., description="The money range value")Changelog
Section titled “Changelog”| Version | Changes |
|---|---|
| 0.1.0 |
|
MoneyComparisonFilter
Section titled “MoneyComparisonFilter”Filters by comparing a field to a monetary value.
| Property | Type | Description |
|---|---|---|
| operator | ComparisonOperators | The operator to apply to the filter value |
| value | Money | The value to use for the filter operation |
Formats
Section titled “Formats”A JSON example of this model.
{ "operator": "gt", "value": { "amount": "-100.5", "currency": "Sample string value" }}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: MoneyComparisonFilter.yamltype: objectproperties: operator: $ref: ComparisonOperators.yaml description: The operator to apply to the filter value value: $ref: Money.yaml examples: - amount: "1000" currency: USD description: The value to use for the filter operationrequired: - operator - valueunevaluatedProperties: not: {}description: Filters by comparing a field to a monetary valueThe TypeSpec code for this model.
/** Filters by comparing a field to a monetary value */model MoneyComparisonFilter { /** The operator to apply to the filter value */ operator: ComparisonOperators;
/** The value to use for the filter operation */ @example(#{ amount: "1000", currency: "USD" }) value: Fields.Money;}The Python code for this model.
class MoneyComparisonFilter(CommonGrantsBaseModel): """Filter for money values using comparison operators."""
operator: ComparisonOperator = Field( ..., description="The operator to apply to the filter value", ) value: Money = Field(..., description="The money value to compare against")
@field_validator("operator", mode="before") @classmethod def validate_operator(cls, v): """Convert string to enum if needed.""" if isinstance(v, str): return ComparisonOperator(v) return vChangelog
Section titled “Changelog”| Version | Changes |
|---|---|
| 0.1.0 |
|