File tree Expand file tree Collapse file tree 5 files changed +28
-0
lines changed Expand file tree Collapse file tree 5 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ class ModelFile extends Decorated {
211211 + TransactionDeclaration[] getTransactionDeclarations()
212212 + EventDeclaration[] getEventDeclarations()
213213 + ParticipantDeclaration[] getParticipantDeclarations()
214+ + ClassDeclaration[] getClassDeclarations()
214215 + ConceptDeclaration[] getConceptDeclarations()
215216 + EnumDeclaration[] getEnumDeclarations()
216217 + MapDeclaration[] getMapDeclarations()
Original file line number Diff line number Diff line change 2424# Note that the latest public API is documented using JSDocs and is available in api.txt.
2525#
2626
27+ Version 3.12.2 {bb8951ea059e312cd347b715bc9fc8d7} 2023-08-28
28+ - Adds ModelFile :: getClassDeclarations
29+
2730Version 3.10.1 {399b057614d1178c02b744184b09f845} 2023-08-22
2831- Change return type for MapDeclaration :: MapKeyType MapValueType
2932
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const packageJson = require('../../package.json');
2020const semver = require ( 'semver' ) ;
2121const AssetDeclaration = require ( './assetdeclaration' ) ;
2222const EnumDeclaration = require ( './enumdeclaration' ) ;
23+ const ClassDeclaration = require ( './classdeclaration' ) ;
2324const ConceptDeclaration = require ( './conceptdeclaration' ) ;
2425const ScalarDeclaration = require ( './scalardeclaration' ) ;
2526const ParticipantDeclaration = require ( './participantdeclaration' ) ;
@@ -575,6 +576,14 @@ class ModelFile extends Decorated {
575576 return this . getDeclarations ( ParticipantDeclaration ) ;
576577 }
577578
579+ /**
580+ * Get the ClassDeclarations defined in this ModelFile
581+ * @return {ClassDeclaration[] } the ClassDeclarations defined in the model file
582+ */
583+ getClassDeclarations ( ) {
584+ return this . getDeclarations ( ClassDeclaration ) ;
585+ }
586+
578587 /**
579588 * Get the ConceptDeclarations defined in this ModelFile
580589 * @return {ConceptDeclaration[] } the ParticipantDeclaration defined in the model file
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ const should = chai.should();
3737chai . use ( require ( 'chai-things' ) ) ;
3838const sinon = require ( 'sinon' ) ;
3939const ScalarDeclaration = require ( '../../lib/introspect/scalardeclaration' ) ;
40+ const ClassDeclaration = require ( '../../lib/introspect/classdeclaration' ) ;
4041
4142describe ( 'ModelFile' , ( ) => {
4243
@@ -720,6 +721,15 @@ describe('ModelFile', () => {
720721 } ) ;
721722 } ) ;
722723
724+ describe ( '#getClassDeclarations' , ( ) => {
725+ it ( 'should return the expected number of Class declarations' , ( ) => {
726+ let modelFile = ParserUtil . newModelFile ( modelManager , carLeaseModel ) ;
727+ let decls = modelFile . getClassDeclarations ( ) ;
728+ decls . should . all . be . an . instanceOf ( ClassDeclaration ) ;
729+ decls . length . should . equal ( 16 ) ;
730+ } ) ;
731+ } ) ;
732+
723733 describe ( '#getFullyQualifiedTypeName' , ( ) => {
724734 it ( 'should return null if not prmative, imported or local type' , ( ) => {
725735 const ast = {
Original file line number Diff line number Diff line change @@ -202,6 +202,11 @@ declare class ModelFile extends Decorated {
202202 * @return {ParticipantDeclaration[] } the ParticipantDeclaration defined in the model file
203203 */
204204 getParticipantDeclarations ( ) : ParticipantDeclaration [ ] ;
205+ /**
206+ * Get the ClassDeclarations defined in this ModelFile
207+ * @return {ClassDeclaration[] } the ClassDeclarations defined in the model file
208+ */
209+ getClassDeclarations ( ) : ClassDeclaration [ ] ;
205210 /**
206211 * Get the ConceptDeclarations defined in this ModelFile
207212 * @return {ConceptDeclaration[] } the ParticipantDeclaration defined in the model file
You can’t perform that action at this time.
0 commit comments