Releases: accordproject/concerto
v3.8.2
v3.8.1
What's Changed
- fix(maps): patch types needed for Typescript generation by @jonathan-casey in #651
Full Changelog: v3.8.0...v3.8.1
v3.8.0
What's Changed
String length validation (from @ragi-dayananda):
String fields may also include an optional length expression, which is used to validate the number of characters in the string field. Both the minimum and maximum length bound are optional, however at least one must be specified. The maximum length must be greater than or equal to the minimum length.
o String name length=[1,100] // greater than or equal to 1 and less than or equal to 100
o String description length=[1,] // greater than or equal to 1
o String comment length=[,100] // less than or equal to 100
[PREVIEW] Map Declarations (from @jonathan-casey):
The feature flag ENABLE_MAP_TYPE
is designed to control the availability of the new MapType in Concerto 3.8.0
.
The feature flag can be activated by setting the environment variable ENABLE_MAP_TYPE=true
, and deactivated setting the environment variable ENABLE_MAP_TYPE=false
, or with the absence of the variable entirely.
Usage
model.cto
namespace com.map.preview@1.0.0
map AuthorsWorks {
o String
o String
}
concept Library {
o String name
o AuthorsWorks books
}
index.js
const map = modelManager.getMapDeclarations()?.pop() // take the first;
map.getName(); // AuthorsWorks
const key = map.getKey();
key.getType(); // String
const value = map.getValue();
value.getType(); // String
map.isMapDeclaration(); // true
map.getFullyQualifiedName(); // [email protected]
Change Log
- feat(*): MapDeclaration Parse & Print by @jonathan-casey in #641
- feat(tools): enum, regex, referential type feature for csharp codegen by @ragi-dayananda in #607
- feat(*): monorepo migration - cleanup packages and references by @jonathan-casey in #639
- feat(*): Support string length validation by @ragi-dayananda in #647
- feat(map): Add Introspection for Map Type by @jonathan-casey in #646
- fix(tools): UUID format fix for jsonschema visitor by @ragi-dayananda in #635
- fix(concerto): fix bugs when id field has regex by @DianaLease in #630
- fix(core): disallow reserved fields in JSON serialization by @mttrbrts in #632
- chore(deps-dev): bump webpack from 5.64.2 to 5.76.0 by @dependabot in #625
- chore(actions): publish v3.7.0 to npm by @github-actions in #620
- chore(deps): bump webpack from 5.74.0 to 5.79.0 in /packages/concerto-util by @dependabot in #634
- chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 by @dependabot in #627
- chore(*) remove Ergo References from Concerto (#610) by @jamieshorten in #637
- chore(deps): bump yaml from 2.0.0-9 to 2.2.2 in /packages/concerto-vocabulary by @dependabot in #640
New Contributors
- @jamieshorten made their first contribution in #637
Full Changelog: v3.7.0...v3.8.0
v3.7.0
What's Changed
- #549 Improved support for Concerto model inference from OpenAPI v3 and JSON Schema files. Exposed on the
concerto infer
CLI command.
const {OpenAPIVisitor} = require("@accordproject/concerto-tools").CodeGen;
//...
const concertoModelJson = OpenApiVisitor
.parse(myOpenApiSpecification)
.accept(
new OpenApiVisitor(), {
metaModelNamespace: '[email protected]',
namespace: '[email protected]',
}
);
console.log(Printer.toCTO(
concertoModelJson.models[0]
));
The generated model also includes types for request and response payloads and untyped "JSON" objects.
- Adds utilities to allow navigation of the dependency tree of a model as a graph. This allows for more advanced operations like "tree-shaking" of large models and finding unused imports.
const {ConcertoGraphVisitor, DirectedGraph} = require("@accordproject/concerto-tools").Common;
// ...
const visitor = new ConcertoGraphVisitor();
const graph = new DirectedGraph();
modelManager.accept(visitor, { graph });
// Find the maximal subgraph starting from 'ChangeOfAddress'
const connectedGraph = graph.findConnectedGraph('[email protected]');
const filteredModelManager = modelManager
.filter(declaration =>
connectedGraph.hasVertex(declaration.getFullyQualifiedName())
);
Commits
- feat(tools): add graph and graph search by @mttrbrts in #614
- feat(tools): parse OpenAPI to Concerto Metamodel JSON by @stefanblaginov in #594
- fix(tools): improve how plantuml namespaces are rendered by @dselman in #615
- fix(tools): Fix for PlantUML relationships and aggregations by @dselman in #616
- fix(metamodel): handle missing optional values in metamodel instance by @mttrbrts in #619
- fix(tools): issue when converting a valid model to Protobuf by @stefanblaginov in #618
- chore(actions): publish v3.6.0 to npm by @github-actions in #612
Full Changelog: v3.6.0...v3.7.0
v3.6.0
What's Changed
- Enhancements to C# Code Generation from Concerto Models.
- Now includes a decorator,
@DotNetType
to allow overriding of the C# primitive type for a property. - Optional properties in Concerto now become nullable fields in C#
- Now includes a decorator,
- The
@accordproject/concerto-util
package contains a new module,Identifiers
, which includes a utility for normalizing strings to valid Concerto identifiers so that they can be used for property names, namespaces, enum values etc.
import { Identifiers } from "@accordproject/concerto-util";
const myId = '1st Item';
const MAX_LENGTH = 200;
const validId = Identifiers.normalizeIdentifier(myId, MAX_LENGTH);
console.log(validId, Identifiers.ID_REGEX.test(validId));
// _1st_Item true
Commits
- feat(tools): csharp codegen nullable type support by @ragi-dayananda in #604
- feat(tools): Support for more dotnet built-in types by @ragi-dayananda in #605
- feat(util): add normalizeIdentifier function by @mttrbrts in #606
- fix(deps): upgrade to webpack 6.75.0 by @mttrbrts in #609
- chore(actions): publish v3.5.0 to npm by @github-actions in #599
Full Changelog: v3.5.0...v3.6.0
v3.5.0
What's Changed
- feat(markdownvisitor): add new params to mermaid codegen used in markdown visitor by @DianaLease in #598
- feat(tools): csharp codegen uuid support by @ragi-dayananda in #597
- chore(actions): publish v3.4.0 to npm by @github-actions in #596
New Contributors
- @ragi-dayananda made their first contribution in #597
Full Changelog: v3.4.0...v3.5.0
v3.4.0
What's Changed
- Enhancements to identifiers. The format for identifiers in Concerto (i.e. the name of Concepts, Properties etc.) has been relaxed to allow values such as
false
,true
andnull
. The format is now consistently applied too, in particular, it is enforced in the JS API and JSON AST. - JSON Schema generation from Concerto models will now include an
anyOf
declaration for types with multiple subtypes - UML output (to Mermaid and PlantUML) for models now supports optional generation of Composition and Aggregation relationships in diagrams. UML output can also omit the base Concerto types (such as
Concept
).
Access the new options via the API parameters or CLI flags.
$ concerto compile --target mermaid --model model.cto --showCompositionRelationships --hideBaseModel
classDiagram
class `org.acme.Root` {
<< concept>>
+ `String` `firstName`
+ `String` `lastName`
+ `DateTime` `dob`
+ `Integer` `age`
+ `Double` `height`
+ `Children[]` `children`
}
`org.acme.Root` "1" *-- "*" `org.acme.Children`
`org.acme.Root` "1" o-- "1" `org.acme.Company` : company
class `org.acme.Person`
<< concept>> `org.acme.Person`
class `org.acme.Children` {
<< concept>>
+ `String` `name`
+ `Integer` `age`
+ `String` `hairColor`
+ `Boolean` `coolDude`
+ `String` `missing`
+ `Pet` `pet`
+ `String[]` `favoriteColors`
+ `Integer[]` `favoriteNumbers`
+ `String[]` `mixed`
+ `String[]` `arrayOfNull`
+ `String[]` `emptyArray`
+ `Pet[]` `favoritePets`
+ `Stuff[]` `stuff`
}
`org.acme.Children` "1" *-- "1" `org.acme.Pet`
`org.acme.Children` "1" *-- "*" `org.acme.Pet`
`org.acme.Children` "1" *-- "*" `org.acme.Stuff`
`org.acme.Children` --|> `org.acme.Person`
class `org.acme.Pet` {
<< concept>>
+ `String` `name`
+ `String` `breed`
}
class `org.acme.Stuff` {
<< concept>>
+ `String` `ssn`
+ `String` `firstName`
+ `String` `sku`
+ `Double` `price`
+ `Pet` `product`
}
`org.acme.Stuff` "1" *-- "1" `org.acme.Pet`
class `org.acme.Company` {
<< concept>>
+ `String` `name`
+ `Employee[]` `employees`
}
`org.acme.Company` "1" *-- "*" `org.acme.Employee`
class `org.acme.Employee` {
<< concept>>
+ `String` `name`
}
`org.acme.Employee` --|> `org.acme.Person`
Commits
- feat(core): relax reserved property names by @mttrbrts in #581
- feat(tools): add composition, aggregation relationships in UML by @mttrbrts in #595
- fix(tools): JSON Schema generation improvements for base types #592 by @dselman in #593
- fix(core): enforce identifier validation on AST JSON by @mttrbrts in #591
- test(core): fix system time offset for tests by @mttrbrts in #590
- chore(actions): publish v3.3.0 to npm by @github-actions in #588
Full Changelog: v3.3.0...v3.4.0
v3.3.0
What's Changed
- Improved validation performance for large models
- Added new (de)serialization parameter
strictQualifiedDateTimes
which makes the parsing and printing of date-time values more predictable in non-UTC offsets
Commits
-
perf(core): refactoring inefficient duplication checking nested for loops during validationby @stefanblaginov in #587
-
fix(core): deal with unqualified date times in local offsets by @mttrbrts in #553
-
chore(deps): bump json5 from 1.0.1 to 1.0.2 in /packages/concerto-tools by @dependabot in #586
-
chore(deps): bump json5 from 2.2.1 to 2.2.3 in /packages/concerto-cli by @dependabot in #585
-
chore(deps): bump json5 from 2.2.1 to 2.2.3 in /packages/concerto-vocabulary by @dependabot in #584
-
chore(deps): bump json5 from 2.2.1 to 2.2.3 in /packages/concerto-util by @dependabot in #583
-
chore(actions): publish v3.2.0 to npm by @github-actions in #578
Full Changelog: v3.2.0...v3.3.0
Concerto v3.2.0
What's Changed
-
feat(tools): support inference from JSON sub schemas by @mttrbrts in #555
-
feat(concerto): Implement Faceted Primitive Types in Concerto by @stefanblaginov in #546
-
feat(core): allow scalar strings to be used as identifiers by @mttrbrts in #562
-
feat(concerto-tools) : generate open api by @dselman in #560
-
fix(*): update metamodel cto to reflect metamodel json by @sstone1 in #557
-
fix(tools): don't capitalize types in JSON Schema inference by default by @mttrbrts in #558
-
fix(*): rework metamodel cto changes, run webpack in pull requests by @sstone1 in #561
-
fix(*): correct name resolution for import types statement by @sstone1 in #563
-
fix(core): properly unbox scalar properties by @mttrbrts in #564
-
fix(tools) : protobuf generation with unversioned namespaces by @dselman in #569
-
fix(core): range value generation for scalars by @mttrbrts in #570
-
fix(tools) define a logical type for timestamps by @dselman in #574
-
chore(main) : update workflows and docs to use main branch by @dselman in #550
-
chore(deps): bump qs from 6.5.2 to 6.5.3 by @dependabot in #565
-
chore(tools) : use nullish coalescing in openapi visitor by @dselman in #566
Full Changelog: v3.1.0...v3.2.0
Concerto v3.1.0
What's Changed
-
feat(proto3): implement a Concerto to Proto3 converter by @stefanblaginov in #539
-
feat(cli): expose infer CTO from JSON Schema to CLI by @mttrbrts in #500
-
fix(typescript) : type definitions for abstractplugin.d.ts by @dselman in #537
-
fix(*): handle version when namespace in comments by @sstone1 in #541
-
Typescript type definitions for EmptyPlugin by @dselman in #538
-
chore(deps): bump minimatch from 3.0.4 to 3.0.5 by @dependabot in #547
-
chore(deps): bump loader-utils from 1.4.0 to 1.4.2 by @dependabot in #548
-
chore(actions): publish v3.0.0 to npm by @github-actions in #535
Full Changelog: v3.0.0...v3.1.0