breeze-entity-generator
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "breeze-entity-generator", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Generate TypeScript modules for entities from Breeze metadata", | ||
@@ -31,4 +31,4 @@ "repository": { | ||
"peerDependencies": { | ||
"breeze-client": ">=2.0.0" | ||
"breeze-client": ">=2.1.5" | ||
} | ||
} |
@@ -6,3 +6,3 @@ # Breeze Entity Generator | ||
Breeze metadata can be generated from [EntityFramework](https://github.com/Breeze/breeze.tooling/tree/master/MetadataGenerator.EFCore), [NHibernate](https://github.com/Breeze/breeze.server.net/blob/master/AspNet/Breeze.ContextProvider.NH/NHMetadataBuilder.cs), [POCO | ||
Breeze metadata can be generated from [EntityFramework](https://github.com/Breeze/northwind-demo/blob/master/server/STEPS-Server-NET5.md#configure-the-program-class-to-generate-metadata), [NHibernate](https://github.com/Breeze/breeze.server.net/blob/master/AspNet/Breeze.ContextProvider.NH/NHMetadataBuilder.cs), [POCO | ||
classes](https://github.com/Breeze/breeze.tooling/tree/master/PocoMetadata), or [handwritten](http://breeze.github.io/doc-js/metadata-by-hand-details.html). | ||
@@ -21,3 +21,4 @@ | ||
baseComplexName: 'BaseComplex', | ||
codePrefix: 'MyProject' | ||
codePrefix: 'MyProject', | ||
useEnumTypes: true | ||
}); | ||
@@ -36,3 +37,3 @@ ``` | ||
**Config Parameters**: | ||
## Config Parameters | ||
@@ -49,3 +50,3 @@ `inputFileName`: Specifies the file containing the metadata | ||
`camelCase`: Optionally generates the property names using camel case. This parameter has no effect if the input file contains Breeze native metadata. (See [NamingConvention](http://www.breezejs.com/sites/all/apidocs/classes/NamingConvention.html#property_camelCase)) | ||
`camelCase`: Optionally generates the property names using camel case. This parameter has no effect if the input file contains Breeze native metadata. (See [NamingConvention](http://breeze.github.io/doc-js/api-docs/classes/namingconvention.html#camelcase)) | ||
@@ -58,3 +59,3 @@ `codePrefix`: Name to put in front of the generated Metadata class and the RegistrationHelper class | ||
**Description**: | ||
## Description | ||
At the core of the typescript generator sits [handlebars](http://handlebarsjs.com/) which is responsible for generating the actual TypeScript source code. The output that handlebars generate can be customized by modifying the templates. | ||
@@ -96,3 +97,3 @@ | ||
**Files**: | ||
## Files | ||
@@ -118,2 +119,3 @@ `node_modules` (Directory containing the third-party node libraries including Breeze) | ||
1.1.0 - Work with breeze-client .mjs modules (as well as older CJS bundles) | ||
1.2.0 - Add support for Complex Type base class and not-null (!) assertions | ||
1.2.0 - Add support for Complex Type base class and not-null (!) assertions. Breaking change: entity.template.txt now imports baseClassName from the parent directory. | ||
1.2.1 - Fix enum type references |
@@ -16,3 +16,4 @@ const tsGen = require('../tsgen-core'); | ||
baseComplexName: 'BaseComplex', | ||
codePrefix: 'Test' | ||
codePrefix: 'Test', | ||
useEnumTypes: true | ||
}); |
@@ -398,2 +398,13 @@ { | ||
{ | ||
"dataType": "NorthwindModel.Models.ProductColor", | ||
"enumType": "ProductColor:#NorthwindModel.Models", | ||
"isNullable": false, | ||
"nameOnServer": "Color", | ||
"validators": [ | ||
{ | ||
"name": "required" | ||
} | ||
] | ||
}, | ||
{ | ||
"dataType": "Decimal", | ||
@@ -552,3 +563,22 @@ "isNullable": true, | ||
} | ||
], | ||
"enumTypes": [ | ||
{ | ||
"shortName": "ProductColor", | ||
"namespace": "NorthwindModel.Models", | ||
"values": [ | ||
"Red", | ||
"Green", | ||
"Blue", | ||
"Yellow" | ||
], | ||
"ordinals": [ | ||
0, | ||
1, | ||
2, | ||
4 | ||
] | ||
} | ||
] | ||
} |
@@ -274,3 +274,3 @@ var fs = require('fs'); | ||
if (useEnumTypes && property.enumType) { | ||
return property.enumType; | ||
return getShortName(property.enumType); | ||
} | ||
@@ -313,3 +313,3 @@ | ||
if (property.isComplexProperty && property.complexTypeName === dependentEntityType.name) return true; | ||
if (property.enumType === dependentEntityType.shortName) { | ||
if (property.enumType && getShortName(property.enumType) === dependentEntityType.shortName) { | ||
return true; | ||
@@ -341,2 +341,6 @@ } | ||
function getShortName(longname) { | ||
return longname.split(':')[0] | ||
} | ||
/** Load and compile the template from the given file */ | ||
@@ -343,0 +347,0 @@ function compileTemplate(filename) { |
38619
942
115