Skip to content

Commit 679e9a3

Browse files
fix: fixed missing import and missing bean annotation (#159)
* Fixed jackson import bug. * Added missing Bean annotation. Co-authored-by: Michael Davis <[email protected]>
1 parent aa30874 commit 679e9a3

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

filters/all.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ function checkPropertyNames(name, schema) {
546546
debugProperty(`schema type : ${schema.type()}`);
547547

548548
for (const propName in properties) {
549-
const javaName = _.camelCase(propName);
549+
const javaName = scsLib.getIdentifierName(propName);
550550
const prop = properties[propName];
551551
debugProperty(`checking ${propName} ${prop.type()}`);
552552

template/src/main/java/Application.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static void main(String[] args) {
5656
{%- if funcSpec.type === 'function' %}
5757
{%- if funcSpec.dynamic %}
5858
{%- if params.dynamicType === 'header' %}
59+
@Bean
5960
{{ funcSpec.functionSignature | safe }} {
6061
return data -> {
6162
// Add business logic here.
@@ -76,6 +77,7 @@ public static void main(String[] args) {
7677
}
7778
{%- else %}{# streamBridge, we need a consumer to call our func. #}
7879
// This is a consumer that calls a send method, instead of a function, because it has a dynamic channel and we need streamBridge.
80+
@Bean
7981
{{ funcSpec.functionSignature | safe }} {
8082
return data -> {
8183
// Add business logic here.

test/__snapshots__/integration.test.js.snap

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ exports[`template integration tests using the generator should generate applicat
305305
"package com.acme;
306306
307307
import com.fasterxml.jackson.annotation.JsonInclude;
308+
import com.fasterxml.jackson.annotation.JsonProperty;
308309
309310
310311
@JsonInclude(JsonInclude.Include.NON_NULL)
@@ -313,12 +314,16 @@ public class MySchema {
313314
public MySchema () {
314315
}
315316
public MySchema (
316-
String prop1) {
317+
String prop1,
318+
String _long) {
317319
this.prop1 = prop1;
320+
this._long = _long;
318321
}
319322
320323
321324
private String prop1;
325+
@JsonProperty(\\"long\\")
326+
private String _long;
322327
323328
public String getProp1() {
324329
return prop1;
@@ -330,9 +335,20 @@ public class MySchema {
330335
}
331336
332337
338+
public String get_long() {
339+
return _long;
340+
}
341+
342+
public MySchema set_long(String _long) {
343+
this._long = _long;
344+
return this;
345+
}
346+
347+
333348
public String toString() {
334349
return \\"MySchema [\\"
335350
+ \\" prop1: \\" + prop1
351+
+ \\" _long: \\" + _long
336352
+ \\" ]\\";
337353
}
338354
}
@@ -479,6 +495,7 @@ public class Application {
479495
}
480496
481497
// This is a consumer that calls a send method, instead of a function, because it has a dynamic channel and we need streamBridge.
498+
@Bean
482499
public Consumer<MySchema> sameFunctionName() {
483500
return data -> {
484501
// Add business logic here.

test/mocks/solace-test-app.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ components:
55
type: object
66
properties:
77
prop1:
8-
default: default string
9-
title: PropertyTitle
8+
type: string
9+
long:
10+
description: The name of this property is a Java reserved word.
1011
type: string
1112
messages:
1213
myEvent:

0 commit comments

Comments
 (0)