org.symphonyoss.s2.canon:canon-runtime-java

JSON API Generation Tooling

License

License

Categories

Categories

Java Languages
GroupId

GroupId

org.symphonyoss.s2.canon
ArtifactId

ArtifactId

canon-runtime-java
Last Version

Last Version

0.2.22
Release Date

Release Date

Type

Type

jar
Description

Description

JSON API Generation Tooling
Project Organization

Project Organization

Symphony Software Foundation

Download canon-runtime-java

How to add to project

<!-- https://jarcasting.com/artifacts/org.symphonyoss.s2.canon/canon-runtime-java/ -->
<dependency>
    <groupId>org.symphonyoss.s2.canon</groupId>
    <artifactId>canon-runtime-java</artifactId>
    <version>0.2.22</version>
</dependency>
// https://jarcasting.com/artifacts/org.symphonyoss.s2.canon/canon-runtime-java/
implementation 'org.symphonyoss.s2.canon:canon-runtime-java:0.2.22'
// https://jarcasting.com/artifacts/org.symphonyoss.s2.canon/canon-runtime-java/
implementation ("org.symphonyoss.s2.canon:canon-runtime-java:0.2.22")
'org.symphonyoss.s2.canon:canon-runtime-java:jar:0.2.22'
<dependency org="org.symphonyoss.s2.canon" name="canon-runtime-java" rev="0.2.22">
  <artifact name="canon-runtime-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.symphonyoss.s2.canon', module='canon-runtime-java', version='0.2.22')
)
libraryDependencies += "org.symphonyoss.s2.canon" % "canon-runtime-java" % "0.2.22"
[org.symphonyoss.s2.canon/canon-runtime-java "0.2.22"]

Dependencies

compile (15)

Group / Artifact Type Version
org.symphonyoss.s2.fugue : fugue-core jar 0.2.53
org.symphonyoss.s2.common : S2-common-core jar 0.2.8
org.symphonyoss.s2.common : S2-common-dom jar 0.2.8
org.symphonyoss.s2.common : S2-common-dom-jackson jar 0.2.8
javax.servlet : javax.servlet-api jar 3.1.0
org.symphonyoss.s2.fugue : fugue-pubsub jar 0.2.53
com.google.protobuf : protobuf-java jar 3.5.1
commons-codec : commons-codec jar 1.10
com.fasterxml.jackson.core : jackson-core jar 2.9.9
com.fasterxml.jackson.core : jackson-databind jar 2.9.9.2
com.google.guava : guava jar 23.5-jre
org.apache.httpcomponents : httpcore jar 4.4.7
org.apache.httpcomponents : httpclient jar 4.5.4
org.slf4j : slf4j-api jar 1.7.25
com.google.code.findbugs : jsr305 jar 3.0.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Canon

JSON API Generation Tooling

The example project can be found at https://github.com/symphonyoss/canon-example Canon is intended to work together with Fugue, see https://symphonyoss.github.io/fugue/

Change Log

Version 0.2.16 - 2020-01-23

URI Mapping

A uriMapping section in the canon maven plugin build configuration allows you to tell the maven plugin to look in your local working copy for dependent models referenced in a model being compiled, rather than reading the dependent model from the URL specified in the main model.

Each property in the uriMapping section contains a name which is a URI which might be encountered in the model being compiled and a value with which that URI should be replaced.

With effect from this release the replacement path is relative to the working directory of the build, not the location of the source model.

<plugin>
  <groupId>org.symphonyoss.s2.canon</groupId>
  <artifactId>canon-maven-plugin</artifactId>
  <executions>
    <execution>
      <phase>generate-sources</phase>
      <goals>
        <goal>generate-sources</goal>
      </goals>
      <configuration>
        <srcDirs>src/main/resources/canon</srcDirs>
        <proformaCopyDir>src/main</proformaCopyDir>
        <uriMapping>
          <property>
           <name>https://models.oss.symphony.com/fundamental.json</name>
           <value>fundamental-model/src/main/resources/canon/fundamental.json</value>
          </property>
          <property>
           <name>https://models.oss.symphony.com/core.json</name>
           <value>core-model/src/main/resources/canon/core.json</value>
          </property>
          <property>
           <name>https://models.oss.symphony.com/crypto.json</name>
           <value>crypto-model/src/main/resources/canon/crypto.json</value>
          </property>
          <property>
           <name>https://models.oss.symphony.com/chat.json</name>
           <value>chat-model/src/main/resources/canon/chat.json</value>
          </property>
        </uriMapping>

        <templateArtifacts>
          <templateArtifact>
            <groupId>${canon.template.groupid}</groupId>
            <artifactId>${canon.template.java}</artifactId>
            <version>${canon.template.version}</version>
          </templateArtifact>
        </templateArtifacts>
      </configuration>
    </execution>
  </executions>
</plugin>

Version 0.0.3 - 2018-02-23

Optional Facade Generation

Facades are now generated in the template directory along with other generated code unless the specification says that a facade is required. This has the effect that for types where you don't want or need a facade the facade class will be automatically regenerated as needed and you don't need to care about it.

"components": {
    "schemas": {
      "IntTypedef": {
        "description": "An integer typedef.",
        "type": "integer"
      },
      "DoubleTypedef": {
        "description": "A double typedef with a facade.",
        "facade": true,
        "type": "number",
        "format": "double",
        "minimum": -765546546547723.03330025,
        "maximum": 7665465456464550000.00333025
      }
    }
  }
}

In the example above the generated files for these two typedefs will be:

canon-test/
├── pom.xml
├── src
│   └── main
│       └── canon
│           └── typeCheck.json
└── target
    ├── generated-sources
    │   ├── annotations
    │   └── java
    │       └── org
    │           └── symphonyoss
    │               └── s2
    │                   └── canon
    │                       └── test
    │                           └── typeCheck
    │                               └── DoubleTypedefTypeDef.java
    │                               ├── IntTypedef.java
    │                               └── IntTypedefTypeDef.java
    └── proforma-sources
        └── java
            └── org
                └── symphonyoss
                    └── s2
                        └── canon
                            └── test
                                └── typeCheck
                                    └── facade
                                        └── DoubleTypedef.java

Note that the facade for IntTypeDef appears in the generated-sources directory whereas the facade for DoubleTypeDef appears in proforma-sources and should be checked in and maintained as a source file. The line in the specification which causes this is

"facade": true,

Note that the default for this value is false.

Inheritance

It is now possible to define (single) inheritance relationships between object types. Consider this specification:

"components": {
    "schemas": {
"FundamentalObject": {
        "type": "object",
        "facade": true,
        "required": [
          "absoluteHash"
        ],
        "properties": {
          "absoluteHash": {
            "$ref": "#/components/schemas/DirectHash"
          },
          "sequenceHashes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DirectHash"
            }
          }
        }
      },
      
      "VersionedObject": {
        "type": "object",
        "facade": true,
        "extends": "#/components/schemas/FundamentalObject",
        "required": [
          "prevHash",
          "baseHash"
        ],
        "properties": {
          "prevHash": {
            "$ref": "#/components/schemas/DirectHash"
          },
          "baseHash": {
            "$ref": "#/components/schemas/DirectHash"
          }
        }
      }
    }
  }
}

The declaration "extends": "#/components/schemas/FundamentalObject", in VersionedObject makes this a sub-class of FundamentalObject.

Note that both of these objects are declared to have a developer managed facade.

The class hierarchy generated is:

VersionedObject extends VersionedObjectEntity extends FundamentalObject extends FundamentalObjectEntity

Where VersionedObjectEntity is the generated super-class and VersionedObject is the developer maintained facade. This means that subclasses inherit the developer maintained additions to any super classes.

Contributing

  1. Fork it (https://github.com/symphonyoss/canon/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Read our contribution guidelines and Community Code of Conduct
  4. Commit your changes (git commit -am 'Add some fooBar')
  5. Push to the branch (git push origin feature/fooBar)
  6. Create a new Pull Request

License

The code in this repository is distributed under the Apache License, Version 2.0.

Copyright 2017-2019 Symphony Communication Services, LLC.

org.symphonyoss.s2.canon

FINOS Symphony Program

Symphony Program within the Fintech Open Source Foundation (FINOS).

Versions

Version
0.2.22
0.2.21
0.2.20
0.2.19
0.2.18
0.2.17
0.2.16
0.2.15
0.2.14
0.2.13
0.2.12
0.2.11
0.2.10
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.0.34
0.0.33
0.0.32
0.0.31
0.0.30
0.0.29
0.0.28
0.0.27
0.0.26
0.0.25
0.0.24
0.0.23
0.0.22
0.0.21
0.0.20
0.0.19
0.0.18
0.0.17
0.0.16
0.0.15
0.0.14
0.0.8
0.0.7
0.0.6
0.0.4
0.0.2