Comments (10)
I'd argue that this is a bug. We should be creating edges that follow the type hierarchy in the GraphVisitor.
from concerto-codegen.
Similar (but different...) would be decorators that referenced types.
from concerto-codegen.
Also Map key and value types.
from concerto-codegen.
I'd argue that this is a bug. We should be creating edges that follow the type hierarchy in the GraphVisitor.
I think I agree with Matt, earlier I thought it could be a addition, but now as I played around it, it feels like a bug.
From the perspective of the mermaid diagram it makes sense and feels like a new addition. But if we want to used the tree shaken model, as given in the example we won't be able instantiate the abstract Pet
concept and would need ClassDeclarations for Cat
and Dog
concepts.
Coming to the point, should we still add the fix as optional? I don't think so. But downside I saw is that after the fix the graph become Directed Cyclic graph, this makes the Flowchart representation a bit clunky.
from concerto-codegen.
Similar (but different...) would be decorators that referenced types.
Apart from the bug we identified from today's tech-wg call.
I have used the following REPL to describe two scenarios.
Referring to both scenarios, won't having a fully qualified type name be more beneficial in decorator arguments object?
It would be easier to get the derived types especially in cases where we might have similar named types in two different namespaces?
currently:
{ type: 'Identifier', name: 'Color', array: false }
suggested change
{ type: 'Identifier', name: '[email protected]', array: false }
from concerto-codegen.
We should make this consistent with what we are doing for other type references, e.g. TypeIdentifier for super class. What does that look like? I also noticed that your code in the REPL seems to be just doing a toString on the object, look at the AST instead, or the API methods.
from concerto-codegen.
I also noticed that your code in the REPL seems to be just doing a toString on the object, look at the AST instead, or the API methods.
I am bit confused about the toString
part
- I am not explicitly doing any
toString
, is there implicit call totoString
you are referring to? - Referring to the AST, this how the arguments object looks like this and even here we don't any reference to the fully qualified type.
"arguments": [
{
"$class": "[email protected]",
"type": {
"$class": "[email protected]",
"name": "Color"
},
"isArray": false,
"location": {
"$class": "[email protected]",
"start": {
"offset": 117,
"line": 9,
"column": 17,
"$class": "[email protected]"
},
"end": {
"offset": 122,
"line": 9,
"column": 22,
"$class": "[email protected]"
}
}
}
]
from concerto-codegen.
We should make this consistent with what we are doing for other type references, e.g. TypeIdentifier for super class. What does that look like?
In the AST both superType and decorator TypeIdentifiers have a similar shape.
"arguments": [
{
"$class": "[email protected]",
"type": {
"$class": "[email protected]",
"name": "Color"
}, .....
"superType": {
"$class": "[email protected]",
"name": "Color"
}
But for super class when I do
declaration.getSuperClass()
I can get a resolved fully qualified type [email protected]
But for reference type decorators I only get [{ type: 'Identifier', name: 'Color', array: false }]
when I do decorator.getArguments()
, which I don't think is incorrect.
But shouldn't the decorator class have some internal methods that can resolve the type reference, similar to the one we have in classDeclaration ?
from concerto-codegen.
But shouldn't the decorator class have some internal methods that can resolve the type reference, similar to the one we have in classDeclaration ?
Yes, you're right, it should. There's a comment in the code that questions this design too!
https://github.com/accordproject/concerto/blob/main/packages/concerto-core/lib/introspect/decorator.js#L80
Can you open an issue for an enhancement to the Introspect API to make it more consistent here, please?
from concerto-codegen.
accordproject/concerto#797
Added it to v4
from concerto-codegen.
Related Issues (20)
- CSharp code gen fails for model containing a concept Transaction
- Concerto error when inferring from a JSON Schema without a body
- Code Generator to bootstrap a vocab file
- Error when inferring from JSON Schema with alternations in body
- Various errors when inferring from JSON Schema
- Unable to compile CSharp code with models containing reserved keywords HOT 4
- TypeScript codegen creates invalid code for models with enums
- Mermaid diagram is incorrect
- Rollup fails to bundle module
- Inferring from JSON Schema may produce Concerto with properties starting with $
- Throw and exception when inferring from JSON Schema and the resulting Concerto is about to include reserved keywords HOT 4
- Update all Concerto main repo dependencies to latest version
- [Enhancement] Create codegen featureset/delta documentation table HOT 1
- add a Accord Project Concerto Contribution Guide link with title in Readme file HOT 4
- Supporting Map type declaration, key and value for vocabulary codegen
- Vocabulary is auto generated for $identifier
- concerto-codegen supports import aliasing for [CSharp + Java]
- Add an option to ConcertoGraphVisistor to only add unidirectional vertices for supertype dependencies
- Bug: ConcertoGraphVisitor does not handle TypeReferece decorators
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from concerto-codegen.