Skip to content

[Java] null property serialization in non-dynamic-property value #87

@vmatyus

Description

@vmatyus

Now I am writing about an issue in Cloudant Java SDK. I updated the java package in our Gauge automated test and the execution detected a deviation in the Java SDK.
In one of the Request Bodys there is a field (source) that defines the route to a database and its authentication. This field received a new auth: null and header: null fields.
When the auth object not defined:

"source": {
    "auth": null,
    "headers": {
      "Authorization": "basic 1234567"
    },
    "url": "${CLOUDANT_URL}/dbname"
  },

When the header is not defined:

"source": {
    "auth": {
        "iam": {
            "api_key": "<api_key>"
        }
    },
    "headers": null,
    "url": "${CLOUDANT_URL}/dbname"
  }

For this request the server answers:

403 Forbidden
{
    "error": "forbidden",
    "reason": "`source.headers' must be a non-null object."
}

I suspect this operation change introduced in this correction: #82
auth component is not a dynamic-property, so this field should not be serialized.
Does headers count to be a dynamic-property value?

Here is the definition of the problematic component:

ReplicationDatabase:
      additionalProperties: false
      description: Schema for a replication source or target database.
      properties:
        auth:
          $ref: '#/components/schemas/ReplicationDatabaseAuth'
        headers:
          additionalProperties:
            type: string
          description: Replication request headers.
          type: object
        url:
          description: Replication database URL.
          type: string
      type: object
ReplicationDatabaseAuth:
      additionalProperties: false
      description: Schema for replication source or target database authentication.
      properties:
        iam:
          $ref: '#/components/schemas/ReplicationDatabaseAuthIam'
      type: object
ReplicationDatabaseAuthIam:
      additionalProperties: false
      description: Schema for an IAM API key for replication database authentication.
      properties:
        api_key:
          description: IAM API key.
          type: string
      type: object

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions