clnsmth / soso

For creating Science On Schema.Org (SOSO) markup in dataset landing pages to improve data discovery through search engines.
https://soso.readthedocs.io/
MIT License
1 stars 0 forks source link

docs: improve strategy return type descriptions #64

Closed clnsmth closed 8 months ago

clnsmth commented 8 months ago

Enhance descriptions of expected return types in the strategy implementation docstrings due to the flexibility of Schema.org properties. For instance, the 'get_keywords' method may return a list of Python strings or dictionaries depending on whether the input is a simple list of keywords or a list of defined terms. Additionally, return types can be 'any' due to potential overrides by the 'kwargs' argument of strategy methods.

Clarify the usage of 'None' return types. Notify users of the strategy API that 'None' is expected from 'get' methods when a NULL result is generated. This ensures a consistent NULL return type from methods where different return types are possible, simplifying type testing for "useful values" by client code like main.convert. Note, it's the responsibility of 'get' methods to identify NULL objects (e.g., empty lists) and return 'None' instead. Failing to do this results in empty JSON-LD containers in the returned SOSO record.

Generally improve the readability of method docstrings.