singhpk234 commented on code in PR #14462:
URL: https://github.com/apache/iceberg/pull/14462#discussion_r2491146362
##########
open-api/rest-catalog-open-api.py:
##########
@@ -143,8 +143,19 @@ class FalseExpression(BaseModel):
)
-class Reference(BaseModel):
- __root__: str = Field(..., example=['column-name'])
+class NamedReference(BaseModel):
+ __root__: str = Field(
+ ..., description='Reference to a column by its name',
example=['column-name']
+ )
+
+
+class IDReference(BaseModel):
+ """
+ Reference to a column by its field ID
+ """
+
+ type: str = Field('reference', const=True)
+ source_id: int = Field(..., alias='source-id')
Review Comment:
I see, i initially modeled `IDReference extends NamedReference` the
representation of id-reference would be something like
```
{
"type" : "reference",
"source-id" : <field-id>
"name" : <colum-name> <--- this is informational only
}
```
Hence an object was required, I agree field-id / source-id is sufficient in
this case, though this would mean IDReference would just be an
UnboundReference much like NamedReference, we need to adapt Unbound etc to
operate on UnboundReference which would ideally be fine but will be a bigger
change.
relevant discussion :
https://github.com/singhpk234/iceberg/pull/270#discussion_r2442770131
Please let me know you thoughts considering above.
-------
I am not sure why this doesn't show up in the python class as the yaml i use
```yaml
allOf:
- $ref: '#/components/schemas/NamedReference'
- type: object
required:
- type
- source-id
properties:
type:
type: string
const: "reference"
source-id:
type: integer
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]