Skip to content

Commit

Permalink
fix: fixed missing import and missing bean annotation (#159)
Browse files Browse the repository at this point in the history
* Fixed jackson import bug.

* Added missing Bean annotation.

Co-authored-by: Michael Davis <[email protected]>
  • Loading branch information
damaru-inc and MichaelDavisSolace authored Sep 13, 2021
1 parent aa30874 commit 679e9a3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion filters/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ function checkPropertyNames(name, schema) {
debugProperty(`schema type : ${schema.type()}`);

for (const propName in properties) {
const javaName = _.camelCase(propName);
const javaName = scsLib.getIdentifierName(propName);
const prop = properties[propName];
debugProperty(`checking ${propName} ${prop.type()}`);

Expand Down
2 changes: 2 additions & 0 deletions template/src/main/java/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static void main(String[] args) {
{%- if funcSpec.type === 'function' %}
{%- if funcSpec.dynamic %}
{%- if params.dynamicType === 'header' %}
@Bean
{{ funcSpec.functionSignature | safe }} {
return data -> {
// Add business logic here.
Expand All @@ -76,6 +77,7 @@ public static void main(String[] args) {
}
{%- else %}{# streamBridge, we need a consumer to call our func. #}
// This is a consumer that calls a send method, instead of a function, because it has a dynamic channel and we need streamBridge.
@Bean
{{ funcSpec.functionSignature | safe }} {
return data -> {
// Add business logic here.
Expand Down
19 changes: 18 additions & 1 deletion test/__snapshots__/integration.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ exports[`template integration tests using the generator should generate applicat
"package com.acme;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
Expand All @@ -313,12 +314,16 @@ public class MySchema {
public MySchema () {
}
public MySchema (
String prop1) {
String prop1,
String _long) {
this.prop1 = prop1;
this._long = _long;
}
private String prop1;
@JsonProperty(\\"long\\")
private String _long;
public String getProp1() {
return prop1;
Expand All @@ -330,9 +335,20 @@ public class MySchema {
}
public String get_long() {
return _long;
}
public MySchema set_long(String _long) {
this._long = _long;
return this;
}
public String toString() {
return \\"MySchema [\\"
+ \\" prop1: \\" + prop1
+ \\" _long: \\" + _long
+ \\" ]\\";
}
}
Expand Down Expand Up @@ -479,6 +495,7 @@ public class Application {
}
// This is a consumer that calls a send method, instead of a function, because it has a dynamic channel and we need streamBridge.
@Bean
public Consumer<MySchema> sameFunctionName() {
return data -> {
// Add business logic here.
Expand Down
5 changes: 3 additions & 2 deletions test/mocks/solace-test-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ components:
type: object
properties:
prop1:
default: default string
title: PropertyTitle
type: string
long:
description: The name of this property is a Java reserved word.
type: string
messages:
myEvent:
Expand Down

0 comments on commit 679e9a3

Please sign in to comment.