Comments (22)
Great, it's all yours!
from concerto.
This may be helpful: https://concerto.accordproject.org/docs/reference/codegen/codegen-create-new
(note that the links in this page are incorrect, as the codgen package was recently moved) cc @jonathan-casey
from concerto.
Hi @dselman,
Just wanted to clarify if this is what the requirement is?
For the following CTO file,
namespace [email protected]
abstract concept Person
{
o String firstName
o String lastName
}
concept Driver extends Person {
o String favoriteColor
}
concept Car identified by vin
{
o String vin
o Person owner
}
If we do concerto vocab --model [email protected]
should hit the new API in concerto-vocabulary to generate a bootstrap teamplate that uses englishMissingTermGenerator
?
Example output YAML file:
locale: en
namespace: [email protected]
declarations:
- Person: # Add your definition
properties:
- lastName: lastName of the Person
- firstName: firstName of the Person
- Driver: # Add your defination
properties:
- favoriteColor: favoriteColor of the Driver
- Car: # Add your definition
properties:
- vin: vin of the Car
- owner: owner of the Car
from concerto.
Close! What I was thinking was a new code generator, so we could run it using:
concerto compile --model [email protected] --target vocabulary
That saves creating a new CLI command etc.
The visitor for the code generator would create a voc file for each model file in the model manager.
The English Missing Term Generator will allow us to populate those # Add your definition
with a machine generated term that people can then customise.
Would you like to work on this one?
from concerto.
Yes sure.
The English Missing Term Generator will allow us to populate those # Add your definition with a machine generated term that people can then customise.
Just saw the method and edited the YAML file.
from concerto.
BTW - the English Missing Term Generator can also be applied to concept names (property name is optional).
from concerto.
Don't forget to register the new code generator here: https://github.com/accordproject/concerto-codegen/blob/main/lib/codegen/codegen.js
And add doc page here: https://github.com/accordproject/concerto-docs/tree/main/docs/reference/codegen
from concerto.
Yes, sure will keep in mind. Thank you Dan. :)
from concerto.
Hi @dselman,
I was testing the vocab file generated by the code generator I've written. While testing it on this repl https://replit.com/join/xeqmqanuuo-sanketshevkar
I'm not able able to add a command set to the model manager when any scalar value is present in the .cto
file. In other cases it's working fine.
I am getting the following error.
TypeError: decl.getProperties is not a function
at /home/runner/AccordProjectConcerto-Vocabulary/node_modules/@accordproject/concerto-vocabulary/lib/vocabularymanager.js:254:22
at Array.forEach (<anonymous>)
at /home/runner/AccordProjectConcerto-Vocabulary/node_modules/@accordproject/concerto-vocabulary/lib/vocabularymanager.js:230:40
at Array.forEach (<anonymous>)
at VocabularyManager.generateDecoratorCommands (/home/runner/AccordProjectConcerto-Vocabulary/node_modules/@accordproject/concerto-vocabulary/lib/vocabularymanager.js:229:38)
at Object.<anonymous> (/home/runner/AccordProjectConcerto-Vocabulary/index.js:126:33)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
Hint: hit control+c anytime to enter REPL.
from concerto.
Another question, how should I output vocab for Scalar
type declarations?
from concerto.
We must have broken vocabulary management when we added scalars. Do you want me to fix that?
We can handle scalars in the vocabulary similar to concepts, just without properties.
from concerto.
If that's how the output should be. I can try to patch it up in the same PR?
I don't think it'll be a blocker for this particular PR. I'll investigate and let you know. If it feels like a small patch I can do it myself.
from concerto.
Ok, thanks - I will leave it to you.
from concerto.
Any progress on this or an ETA? I have a need for this.
from concerto.
- Need handle case for relation and scalars.
- Write test cases.
By when do you require this? Should be a few hours work at max. Sorry, kept it on hold, because I have an interview scheduled this week.
If it's urgent for you I can prioritize it from my side.
from concerto.
If you create a draft PR with what you have then I can work on it as well.
from concerto.
- Created a new issue in concerto-codegen
- Relationship and Scalar are now handled
- Need to write tests for field: (fields, enum values, relationships)
I'm trying to raise a PR on concerto-codegen but getting an error, regarding permission
remote: Permission to accordproject/concerto-codegen.git denied to sanketshevkar.
fatal: unable to access 'https://github.com/accordproject/concerto-codegen.git/': The requested URL returned error: 403
from concerto.
Strange. I see other PRs have been created: https://github.com/accordproject/concerto-codegen/branches
You need to fork the repo and then create your PR to merge from your fork back to the main branch.
from concerto.
Ahh 😅
Hadn't forked the repo.
Here's the PR to be reviewed accordproject/concerto-codegen#22
Thanks @dselman
from concerto.
I have completed the tests, can you review the PR? @dselman
from concerto.
Documentation for vocabulary code generation
accordproject/concerto-docs#16
from concerto.
This has been implemented.
from concerto.
Related Issues (20)
- Provide an API to extend the default rules of the analyser
- Inconsistent ast types in introspect HOT 2
- Issue trying to validate declarations without properties
- Support Decorator Command Set validation independent of applying decorators
- Support max length for array and map
- "Install the Command Line Tool" link is broken in readme
- Vocabulary support for Map Types in Concerto HOT 3
- JSON Schema output is not working for Scalar Arrays
- Concerto CLI parser allows multiple application of the same Decorator, but not ModelManager HOT 1
- Should not be able to create a concept whose super type is itself
- Decorator Command with properties without a type adds decorator to declaration
- feat: Extract the vocabulary set and decorator command set from a model manager
- Remove Functional API
- VocabularyManager: support configurable fallback locales
- Migrate to ESM from CommonJS Modules HOT 1
- Map does not support polymorphic values HOT 1
- While validating a `ConceptDeclaration` with no properties, the validation fails ungracefully if the `properties` field of the AST is `null` HOT 2
- Errors when creating validators in concerto introspect only return a string in a error message , which makes programatic handling the errors dificult
- Vocabulary auto generated for $identifier HOT 6
- toAst and fromAst are not identity operation HOT 3
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.