Skip to content

Commit da4c2c6

Browse files
Added missing 'type' property to specs.json (#10)
* Added missing 'type' property to specs.json * Fixed version * Fixed type for server variables --------- Co-authored-by: Gastón Ortiz <gaston.ortiz@hotovo.com>
1 parent 6c9656e commit da4c2c6

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Java Client Library (beta)
2-
### v0.3.2
2+
### v0.3.3
33

44
## Introduction
55
Welcome my friends! This is the Poly API Java client GitHub page. If you are here, then it means you're familiar with what we do at Poly. If you aren't, you can always check [here](https://github.com/polyapi/poly-alpha).
@@ -53,7 +53,7 @@ Nice to have some customers looking around here! So, you'll need to run the foll
5353
2. **Update the project.** Add the following to your project's `pom.xml`:
5454
```xml
5555
<properties>
56-
<poly.version>0.3.2</poly.version>
56+
<poly.version>0.3.3</poly.version>
5757
</properties>
5858
<dependencies>
5959
<dependency>
@@ -347,17 +347,17 @@ Comparing to its Typescript counterpart, the Java library is still missing the f
347347
These features will be added in the future releases.
348348

349349
## Changelog
350+
### v0.3.3
351+
- Fixed 'type' property for Server variables
352+
- Added missing 'type' property to specs.json
350353
### v0.3.2
351354
- Fixed bug in deploy-functions where inner classes weren't taken into consideration.
352355
- Refactored deploy-functions to be reflection based instead of reading source code.
353-
354356
### v0.3.1
355357
- Fixed bug in deploy-functions where generics weren't taken into consideration.
356-
357358
### v0.3.0
358359
- Added deploy-functions MOJO.
359360
- Added functionality to add maven dependencies to executions.
360-
361361
### v0.2.5
362362
- Fixed bug where enums were generated as inner classes.
363363
- Fixed bug in generation of custom functions.

polyapi-maven-plugin/src/main/java/io/polyapi/plugin/model/specification/Specification.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
@Setter
3030
@JsonTypeInfo(
3131
use = JsonTypeInfo.Id.NAME,
32-
property = "type"
32+
property = "type",
33+
visible = true
3334
)
3435
@JsonSubTypes({
3536
@JsonSubTypes.Type(value = ApiFunctionSpecification.class, name = "apiFunction"),
@@ -41,6 +42,7 @@
4142
})
4243
public abstract class Specification implements Generable {
4344
private String id;
45+
private String type;
4446
private String context;
4547
private String name;
4648
private String description;

polyapi-maven-plugin/src/main/java/io/polyapi/plugin/model/specification/variable/ServerVariableSpecification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected String getTypePackage() {
2222
return "variable.server";
2323
}
2424

25-
public String getType() {
25+
public String getValueType() {
2626
return variable.getValueType().getType(getClassName());
2727
}
2828

polyapi-maven-plugin/src/main/resources/templates/ServerVariableSpecification.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import io.polyapi.client.api.model.PolyMetadata;
55
import io.polyapi.client.api.model.variable.{{~#if variable.secret}}ServerVariable{{~else}}RetrievableServerVariable{{/if}}Handler;
66

77
@PolyEntity("{{id}}")
8-
@PolyMetadata(paramTypes = "{{{type}}}")
9-
public interface {{className}}Handler extends{{~#if variable.secret}} ServerVariable{{~else}} RetrievableServerVariable{{/if}}Handler<{{type}}> {
8+
@PolyMetadata(paramTypes = "{{{valueType}}}")
9+
public interface {{className}}Handler extends{{~#if variable.secret}} ServerVariable{{~else}} RetrievableServerVariable{{/if}}Handler<{{valueType}}> {
1010
{{~#if variable.secret}}
1111
{{~else}}
1212
@Override
13-
{{type}} get();
13+
{{valueType}} get();
1414
{{/if}}
1515

1616
@Override
17-
void update({{type}} value);
17+
void update({{valueType}} value);
1818
}

polyapi-maven-plugin/src/main/resources/templates/Vari.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public final class Vari extends PolyContext {
1919
{{~#each specifications}}
2020
{{~#ifIsType this "ServerVariableSpecification"}}
2121
@PolyEntity("{{id}}")
22-
private static final {{type}} {{name}};
22+
private static final {{valueType}} {{name}};
2323
{{~/ifIsType}}
2424
{{~/each}}
2525
{{#each subcontexts}}
@@ -30,7 +30,7 @@ static {
3030
var vari = new Vari();
3131
{{~#each specifications}}
3232
{{~#ifIsType this "ServerVariableSpecification"}}
33-
{{name}} = vari.createServerVariable("{{{type}}}", "{{{packageName}}}");
33+
{{name}} = vari.createServerVariable("{{{valueType}}}", "{{{packageName}}}");
3434
{{~/ifIsType}}
3535
{{~/each}}
3636
{{#each subcontexts}}
@@ -39,13 +39,13 @@ var vari = new Vari();
3939
}
4040

4141
{{~#ifIsType this "ServerVariableSpecification"}}
42-
public static void update{{{className}}}Variable({{{type}}} value) {
42+
public static void update{{{className}}}Variable({{{valueType}}} value) {
4343
this.{{name}}Handler.update(value);
4444
}
4545

4646
{{~#if variable.secret}}
4747
{{~else}}
48-
public static {{{type}}} get{{{className}}}Variable() {
48+
public static {{{valueType}}} get{{{className}}}Variable() {
4949
return this.{{name}}Handler.get();
5050
}
5151
{{/if}}

0 commit comments

Comments
 (0)