This repository demonstrates multiple OpenAPI code generation tools for the pyDataverse API. Based on an OpenAPI specification drawn from from Dataverse 5.14 ednpoint /openapi all paths that are utilized in pyDataverse's NativeAPI have been extracted and utilized to generate client side code. Due to missing request bodies and responses in the OpenAPI specifications, the generated code is far from optimal. However, it is a good starting point for further development and highlights the differences between the code generation tools.
Important
These are all the relevant files and their descriptions:
pydataverse_openapi_schema.yaml- Contains the OpenAPI specification for the pyDataverse NativeAPIpydataverse_nativeapi_paths.txt- Collection of paths in pyDataverse's NativeAPIdataverse_5_14_openapi_schema.yaml- Contains the OpenAPI specification for Dataverse 5.14openapi_generator- Contains the generated code from OpenAPI Generatorspeakeasy- Contains the generated code from Speakeasygenerate.sh- Script to generate the code from the OpenAPI specificationgen.yaml- Configuration file for Speakeasy
- PersistentId endpoints
api/v1/datasetsPOST request for dataset creation- Response and Request-Body schemes for almost all endpoints missing
- Existing request body schemes
/api/v1/dataverses/{identifier}/roles/api/v1/roles
- Authentication information missing
/api/v1/files/{id}/metadata
versionIdis expected within the path, but is not included- Maybe it is a query parameter?
some/path/{id}:
get:
summary: Get a specific object
description: Get a specific object
operationId: getSpecificObject
security:
- ApiKeyAuth:
type: apiKey
in: header
name: X-Dataverse-key
parameters: ...
responses: ...Below is a list of SDKs that have been generated based on pyDataverse's OAI spec:
- OpenAPI generator allows to preserve existing objects
Below is a list of SDKs that have been generated based on pyDataverse's OAI spec:
- Well-structured code and less lines
- Python generator based on
dataclassesand thus less dependent on third-party libs - Allows to customize the generated code beyond OpenAPI specification