https://linen.dev logo
m

Maxime Lavoie

11/09/2021, 8:00 PM
Keeping in line with the pydantic models, anyone knows how to declare properties of a BaseModel in such a way as to produce a
"oneOf": [{…}, {…}]
type structure? I’ve tried different approaches and the closest I got was an
"anyOf": [{…},{…}]
structure using
account_ids: Union[AccountConfigStrategy1, AccountConfigStrategy2] = Field(...)
I am ultimately wanting to reproduce the
accounts
property in the source-bing-ads spec but declared as a pydantic model instead of a json file. https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-bing-ads/source_bing_ads/spec.json#L23
u

user

11/09/2021, 8:25 PM
Did you try using Option[List[AccountConfigStragetegy]]? Are you using Pydantic for the specification fields or the schema?
u

user

11/10/2021, 6:12 AM
@[DEPRECATED] Marcos Marx, I am using Pydantic for the specification fields.
u

user

11/10/2021, 6:13 AM
Do you mean trying to use
Optional
or
Option
? What would be the import statement for
Option
I can’t seem to find it.
2 Views