@charlietango/react-docs-net
Advanced tools
@@ -101,2 +101,21 @@ // | ||
function formatType( | ||
type , | ||
required , | ||
isEnum = false | ||
) { | ||
if (!required && type.type) { | ||
if (isEnum) return type.type + '?'; | ||
switch (type) { | ||
case 'int': | ||
case 'number': | ||
case 'DateTime': | ||
return type.type + '?'; | ||
default: | ||
break; | ||
} | ||
} | ||
return type.type; | ||
} | ||
module.exports = { | ||
@@ -108,2 +127,3 @@ comment, | ||
typesName, | ||
formatType, | ||
ns, | ||
@@ -110,0 +130,0 @@ isEnumNumbers, |
@@ -8,4 +8,2 @@ // | ||
import { getUsingTypes } from '../helpers'; | ||
const upperFirst = require('lodash/fp/upperFirst'); | ||
@@ -15,2 +13,4 @@ const ns = require('../helpers').ns; | ||
const modelName = require('../helpers').modelName; | ||
const getUsingTypes = require('../helpers').getUsingTypes; | ||
const formatType = require('../helpers').formatType; | ||
const getType = require('../csharp-types').getType; | ||
@@ -46,5 +46,6 @@ | ||
if (!!header) output += `\n${header}`; | ||
output += `${' '.repeat(indent)}public virtual ${type.type} ${upperFirst( | ||
name | ||
)} { get; set; }\n`; | ||
output += `${' '.repeat(indent)}public virtual ${formatType( | ||
type, | ||
prop.required | ||
)} ${upperFirst(name)} { get; set; }\n`; | ||
if (type.model) models.push(type.model); | ||
@@ -51,0 +52,0 @@ if (type.references) referencedModels.push(type.references); |
@@ -19,2 +19,3 @@ // | ||
const getType = require('../csharp-types').getType; | ||
const formatType = require('../helpers').formatType; | ||
@@ -40,3 +41,2 @@ function injectProps(vmName , props = {}, indent = 0) { | ||
const type = getType(name, prop.flowType, vmName, flags); | ||
if (type && type.warning) warnings.push(type.warning); | ||
@@ -74,3 +74,5 @@ if (!type || !type.type) return ''; | ||
if (!!header) output += `\n${header}`; | ||
if (type.model && type.model.types && !isEnumNumbers(type.model.types)) { | ||
const isEnum = | ||
type.model && type.model.types && !isEnumNumbers(type.model.types); | ||
if (isEnum) { | ||
output += `${' '.repeat( | ||
@@ -80,5 +82,8 @@ indent | ||
} | ||
output += `${' '.repeat(indent)}public virtual ${type.type} ${upperFirst( | ||
name | ||
)} { get; set; }\n`; | ||
output += `${' '.repeat(indent)}public virtual ${formatType( | ||
type, | ||
prop.required, | ||
isEnum | ||
)} ${upperFirst(name)} { get; set; }\n`; | ||
if (type.model) models.push(type.model); | ||
@@ -85,0 +90,0 @@ if (type.references) referencedModels.push(type.references); |
{ | ||
"name": "@charlietango/react-docs-net", | ||
"description": "Package and publish a NuGet package to a custom feed.", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"main": "lib/index.js", | ||
@@ -48,3 +48,3 @@ "bin": { | ||
}, | ||
"gitHead": "7fd4c10f2b27cc7ed3c9ada4c880950ebf511273" | ||
"gitHead": "9f26a50a4435cf5b83a78056f32c6eeb799808ef" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48298
2.51%813
3.3%