datafoodconsortium / connector-codegen

An Acceleo project to generate the source code of the DFC connector into all the supported programming languages.
MIT License
3 stars 3 forks source link

Default values hide intentionally missing attributes #13

Closed mkllnk closed 4 months ago

mkllnk commented 8 months ago

The connector initialises all semantic objects with defaults:

https://github.com/datafoodconsortium/connector-codegen/blob/64e2089693704193cc1c2e5960b5713bc4578195/src/org/datafoodconsortium/connector/codegen/ruby/operation.mtl#L42-L44

But with those defaults, we can't tell if the parameter was never set or set to the default value. This is especially problematic with stockLimiation. If a product doesn't have a stock limitation then the only way to indicate that is to omit the attribute.

When exporting data via the connector, you can override the default with nil and then the attribute will not appear in the output. But when importing RDF documents, we don't override every missing attribute with nil. Even if you add the attribute with a null value to the RDF document the parser will ignore it.

@lecoqlibre Do we need the default values? Or can we set them all to nil to mark them as unset.

lecoqlibre commented 7 months ago

I guess it's OK to use nil instead the default value except for the semanticId property. Did you try it already @mkllnk? Especially when exporting/importing?

mkllnk commented 7 months ago

No, I haven't tried it. But I could work on a pull request.