Skip to content

Improvements to SignatureRequest and Fax response schemas#442

Merged
jtreminio-dropbox merged 5 commits intomainfrom
signature_request-response-improvements
Oct 31, 2024
Merged

Improvements to SignatureRequest and Fax response schemas#442
jtreminio-dropbox merged 5 commits intomainfrom
signature_request-response-improvements

Conversation

@jtreminio-dropbox
Copy link
Contributor

@jtreminio-dropbox jtreminio-dropbox commented Oct 18, 2024

Changes in this PR:

The metadata property has had its schema updated to reflect what you actually get back from the API. Affected schemas are:

  • BulkSendJobGetResponseSignatureRequests.metadata
  • SignatureRequestResponse.metadata
  • TemplateResponse.metadata

The change is:

  • C#: From Object to Dictionary<string, Object>
  • Java: From Object to Map<String, Object>
  • Node: From object to { [key: string]: any }
  • PHP: Remains array but typehint is now array<string,mixed>
  • Python: From object to Dict[str, object]
  • Ruby: From Object to Hash<String, Object>

Additional changes:

  • BulkSendJobGetResponseSignatureRequests.test_mode is now non-nullable
  • BulkSendJobGetResponseSignatureRequests.expires_at is now nullable
  • SignatureRequestResponse.test_mode is now non-nullable
  • SignatureRequestResponse.expires_at is now nullable
  • FaxResponse.transmissions is now non-nullable
  • FaxResponse.subject is now nullable
  • FaxResponse.message is now nullable
  • FaxResponse.final_copy_uri nullable string has been added
  • FaxResponseTransmission.sender removed

This PR fixes a bug with the BulkSendJobGetResponseSignatureRequests schema. It inherits all of the properties in the SignatureRequestResponse schema, but the metadata definition causes problems when SDKs are being generated.

To solve this, I've added metadata to BulkSendJobGetResponseSignatureRequests.

More details:

Fun fact! You can define a property as a key:value (aka javascript object or python dict type) in OpenAPI as follows:

metadata:
    description: 'The metadata attached to the template.'
    type: object
    additionalProperties: {}

This makes the shape of metadata as { [key:string]: any } which is what we want for metadata because it can be any shape a customer decides as long as the key is a string.

We can also define a schema as extending another schema which allows it to inherit all the parent schema's properties, as so:

BulkSendJobGetResponseSignatureRequests:
  title: BulkSendJobGetResponseSignatureRequests
  type: object
  allOf:
    -
      $ref: '#/components/schemas/SignatureRequestResponse'
    -
      properties:
        bulk_send_job_id:
          description: 'The id of the BulkSendJob.'
          type: string

However, there's a bug with the openapi-generator tool when generating SDKs where if a schema extends another using allOf, and the parent schema has a property of type: object, the final type of that property in some SDKs is wrong.

  • In Typescript we expect { [key: string]: any } but it actually generates object which is technically not wrong but incorrect all the same.
  • PHP: Expect array<string,mixed> but get array
  • C#: Expect Dictionary<string, Object> get Object
  • Java: Expect Map<String, Object> get Object
  • Python: Expect Dict[str, object] get object
  • Ruby: Expect Hash<String, Object> get Object

The solution is to add the property to the child schema:

BulkSendJobGetResponseSignatureRequests:
  title: BulkSendJobGetResponseSignatureRequests
  type: object
  allOf:
    -
      $ref: '#/components/schemas/SignatureRequestResponse'
    -
      properties:
        bulk_send_job_id:
          description: 'The id of the BulkSendJob.'
          type: string
        metadata:
          description: 'The metadata attached to the signature request.'
          type: object
          additionalProperties: {}

@jtreminio-dropbox jtreminio-dropbox added SDK - Dotnet Affects the Dotnet SDK SDK - Java Affects the Java SDK SDK - Node Affects the Node SDK SDK - PHP Affects the PHP SDK SDK - Python Affects the Python SDK SDK - Ruby Affects the Ruby SDK MINOR version bump New functionality, backwards-compatible. major.MINOR.path labels Oct 18, 2024
@jtreminio-dropbox jtreminio-dropbox added this to the H24SP20 milestone Oct 18, 2024
@jtreminio-dropbox jtreminio-dropbox force-pushed the signature_request-response-improvements branch from 28dabc1 to 6394b84 Compare October 25, 2024 17:44
@jtreminio-dropbox jtreminio-dropbox marked this pull request as ready for review October 25, 2024 19:54
@jtreminio-dropbox jtreminio-dropbox modified the milestones: H24SP20, H24SP22 Oct 29, 2024
@jtreminio-dropbox jtreminio-dropbox force-pushed the signature_request-response-improvements branch from 6394b84 to 34809ed Compare October 30, 2024 19:20
@jtreminio-dropbox jtreminio-dropbox changed the title Improvements to SignatureRequest response Improvements to SignatureRequest and Fax response schemas Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MINOR version bump New functionality, backwards-compatible. major.MINOR.path SDK - Dotnet Affects the Dotnet SDK SDK - Java Affects the Java SDK SDK - Node Affects the Node SDK SDK - PHP Affects the PHP SDK SDK - Python Affects the Python SDK SDK - Ruby Affects the Ruby SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants