Skip to content

Commit

Permalink
airbyte-api: add jackson model annotations to remove null values from…
Browse files Browse the repository at this point in the history
… responses (#13370)
  • Loading branch information
alafanechere authored Jun 3, 2022
1 parent d30716a commit c3170f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
10 changes: 9 additions & 1 deletion airbyte-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ task generateApiServer(type: GenerateTask) {
configOptions = [
dateLibrary : "java8",
generatePom : "false",
interfaceOnly: "true"
interfaceOnly: "true",
/*
JAX-RS generator does not respect nullable properties defined in the OpenApi Spec.
It means that if a field is not nullable but not set it is still returning a null value for this field in the serialized json.
The below Jackson annotation is made to only keep non null values in serialized json.
We are not yet using nullable=true properties in our OpenApi so this is a valid workaround at the moment to circumvent the default JAX-RS behavior described above.
Feel free to read the conversation on https://github.com/airbytehq/airbyte/pull/13370 for more details.
*/
additionalModelTypeAnnotations: "\n@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)"
]
}
compileJava.dependsOn tasks.generateApiServer
Expand Down
11 changes: 0 additions & 11 deletions airbyte-api/src/main/openapi/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2323,7 +2323,6 @@ components:
type: string
CustomerioNotificationConfiguration:
type: object
nullable: true
NotificationType:
type: string
enum:
Expand Down Expand Up @@ -3141,7 +3140,6 @@ components:
sourceCatalogId:
type: string
format: uuid
nullable: true
WebBackendConnectionCreate:
type: object
required:
Expand Down Expand Up @@ -3222,7 +3220,6 @@ components:
sourceCatalogId:
type: string
format: uuid
nullable: true
WebBackendConnectionUpdate:
type: object
required:
Expand Down Expand Up @@ -3309,7 +3306,6 @@ components:
sourceCatalogId:
type: string
format: uuid
nullable: true
ConnectionSearch:
type: object
properties:
Expand Down Expand Up @@ -3387,7 +3383,6 @@ components:
ConnectionSchedule:
description: if null, then no schedule is set.
type: object
nullable: true
required:
- units
- timeUnit
Expand Down Expand Up @@ -3519,7 +3514,6 @@ components:
#- unnesting
OperatorDbt:
type: object
nullable: true
required:
- gitRepoUrl
properties:
Expand Down Expand Up @@ -3600,7 +3594,6 @@ components:
sourceDefinedCursor:
description: If the source defines the cursor field, then any other cursor field inputs will be ignored. If it does not, either the user_provided one is used, or the default one is used as a backup.
type: boolean
nullable: true
defaultCursorField:
description: Path to the field that will be used to determine if a record is new or modified since the last sync. If not provided by the source, the end user will have to specify the comparable themselves.
type: array
Expand All @@ -3615,7 +3608,6 @@ components:
type: string
namespace:
type: string
nullable: true
description: Optional Source-defined namespace. Airbyte streams from the same sources should have the same namespace. Currently only used by JDBC destinations to determine what schema to write to.
StreamJsonSchema:
type: object
Expand Down Expand Up @@ -3796,7 +3788,6 @@ components:
$ref: "#/components/schemas/AttemptFailureSummary"
AttemptStats:
type: object
nullable: true
properties:
recordsEmitted:
type: integer
Expand All @@ -3822,7 +3813,6 @@ components:
$ref: "#/components/schemas/AttemptStats"
AttemptFailureSummary:
type: object
nullable: true
required:
- failures
properties:
Expand Down Expand Up @@ -4036,7 +4026,6 @@ components:
ResourceRequirements:
description: optional resource requirements to run workers (blank for unbounded allocations)
type: object
nullable: true
properties:
cpu_request:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ configuration:
- integer
type: object
name: pokemon
namespace: null
source_defined_cursor: null
source_defined_primary_key: []
supported_sync_modes:
- full_refresh

0 comments on commit c3170f9

Please sign in to comment.