Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
fix: When enum in object property was null, it broke
Browse files Browse the repository at this point in the history
Fixes #762
  • Loading branch information
Delawen committed Jul 13, 2023
1 parent b23298c commit bb8c76b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void beans() throws Exception {
"Integration#integration-multiroute.yaml", "Kamelet#jms-amqp-10-source.kamelet.yaml",
"Integration#integration-no-step.yaml", "Integration#integration-with-beans.yaml",
"Kamelet#beans.kamelet.yaml", "Kamelet#aws-cloudtrail.yaml",
"Kamelet#avro-serialize-action.kamelet.yaml"})
"Kamelet#avro-serialize-action.kamelet.yaml", "Kamelet#google-bigquery-sink.kamelet.yaml"})
void roundTrip(String file) throws IOException {

String[] parameters = file.split("#");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
annotations:
camel.apache.org/kamelet.support.level: Stable
camel.apache.org/catalog.version: 4.0.0-SNAPSHOT
camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI1MDAiIHdpZHRoPSIyNTAwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgICAgdmlld0JveD0iLTEuNjMzMjM1NDMzMzI4MjU2IDcuMDMyNjA5MzMwMzE1NjU2NSAxMzEuMjY1NzQ2ODI0MTY4NzYgMTE0LjYzNDM5MDY2OTY4NDM1IiB2ZXJzaW9uPSIxLjAiPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJhIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjY0IiB4Mj0iNjQiIHkxPSI3LjAzNCIgeTI9IjEyMC43ODkiPgogICAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzQzODdmZCIvPgogICAgICAgIDxzd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MjFhMTIuNzk0IDEyLjc5NCAwIDAgMCA0LjM4IDQuNDc1VjYzLjEwNHpNNjEuNjc1IDU3LjAyNnYxOS40MTFjLjc0NS4xMzcgMS41MDcuMjIgMi4yOS4yMi43MTQgMCAxLjQxLS4wNzUgMi4wOTMtLjE4OVY1Ny4wMjZ6TTcwLjc2NiA2Ni4xdjguNTYyYTEyLjc4NiAxMi43ODYgMCAwIDAgNC4zODItNC43di0zLjg2MXpNODAuNjkxIDc4LjI4N2wtMi40MDMgMi40MDVhMS4wODggMS4wODggMCAwIDAgMCAxLjUzN2w5LjExNSA5LjExMmExLjA4OCAxLjA4OCAwIDAgMCAxLjUzNyAwbDIuNDAzLTIuNDAyYTEuMDkyIDEuMDkyIDAgMCAwIDAtMS41MzZsLTkuMTE2LTkuMTE2YTEuMDkgMS4wOSAwIDAgMC0xLjUzNiAwIi8+CiAgICA8L2c+Cjwvc3ZnPg==
camel.apache.org/provider: Apache Software Foundation
camel.apache.org/kamelet.group: Google Big Query
camel.apache.org/kamelet.namespace: GCP
labels:
camel.apache.org/kamelet.type: sink
name: google-bigquery-sink
spec:
definition:
properties:
projectId:
description: The Google Cloud Project ID.
title: Google Cloud Project Id
type: string
dataset:
description: The Big Query Dataset ID.
title: Big Query Dataset Id
type: string
table:
description: The Big Query Table ID.
title: Big Query Table Id
type: string
serviceAccountKey:
description: The service account key to use as credentials for BigQuery.
title: Service Account Key
type: object
required:
- projectId
- dataset
- table
- serviceAccountKey
title: Google Big Query Sink
type: object
dependencies:
- camel:core
- camel:kamelet
- camel:google-bigquery
- camel:jackson
template:
from:
uri: kamelet:source
steps:
- unmarshal:
json:
library: Jackson
- to:
uri: google-bigquery:{{projectId}}:{{dataset}}:{{table}}
parameters:
serviceAccountKey: base64:{{serviceAccountKey}}
types:
in:
mediaType: application/json
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private void processParameters(final ParseResult<Step> res,
break;
default:
p = new ObjectParameter(key, def.getTitle(), def.getDescription(), def.getNullable(),
def.get_enum().toArray(new AnyType[0]),
def.get_enum() != null ? def.get_enum().toArray(new AnyType[0]) : null,
def.getExample() != null ?
new Object[]{ def.getExample().getValue()} :
null,
Expand Down

0 comments on commit bb8c76b

Please sign in to comment.