Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public updatePropertyForMap(property, innerProperty) {
if (innerProperty == null) {
log.warn(`skipping invalid map property ${Json.pretty(property)}`)
return
} else {
if (!this.__languageSpecificPrimitives.contains(innerProperty.baseType)) {
property.complexType = innerProperty.baseType
} else {
property.isPrimitiveType = true
}
property.items = innerProperty
if (this.isPropertyInnerMostEnum(property)) {
property.isEnum = true
this.updateDataTypeWithEnumForMap(property)
property.allowableValues = this.getInnerEnumAllowableValues(property)
}
}
}
public async addAndroidPluginHookClasses(
plugins: PackagePath[],
outDir: string
): Promise {
for (const plugin of plugins) {
if (plugin.basePath === 'react-native') {
continue
}
const pluginConfig = await manifest.getPluginConfig(plugin)
if (!pluginConfig) {
continue
}
if (!pluginConfig.android) {
log.warn(
`Skipping ${
plugin.basePath
} as it does not have an Android configuration`
)
continue
}
const androidPluginHook = pluginConfig.android.pluginHook
if (androidPluginHook) {
log.debug(`Adding ${androidPluginHook.name}.java`)
if (!pluginConfig.path) {
throw new Error('No plugin config path was set. Cannot proceed.')
}
const pathToPluginConfigHook = path.join(
pluginConfig.path,
`${androidPluginHook.name}.java`
)
export const commandHandler = async ({ key }: { key: string }) => {
await logErrorAndExitIfNotSatisfied({
isValidPlatformConfig: {
key,
},
})
if (ernConfig.get(key)) {
log.info(`Configuration value for ${key} is ${ernConfig.get(key)}`)
} else {
log.warn(`${key} was not found in config`)
}
}
property = new MapProperty(inner)
collectionFormat = qp.getCollectionFormat()
const pr = this.fromProperty('inner', inner)
p.baseType = pr.datatype
p.isContainer = true
p.isMapContainer = true
imports.add(pr.baseType)
} else {
property = PropertyBuilder.build(
type,
qp.getFormat(),
newHashMap(['enum', qp.getEnum()])
)
}
if (property == null) {
log.warn(
`warning! Property type "${type}" not found for parameter "${(param as any).getName()}", using String`
)
property = (new StringProperty() as any).description(
'//TODO automatically added by swagger-codegen. Type was ' +
type +
' but not supported'
)
}
property.setRequired((param as any).getRequired())
const cp = this.fromProperty(qp.getName(), property)
this.setParameterBooleanFlagWithCodegenProperty(p, cp)
p.dataType = cp.datatype
p.dataFormat = cp.dataFormat
if (cp.isEnum) {
p.datatypeWithEnum = cp.datatypeWithEnum
}
name = this.modelNamePrefix + '_' + name
}
if (!isEmpty(this.modelNameSuffix)) {
name = name + '_' + this.modelNameSuffix
}
name = DefaultCodegen.camelize(name)
if (this.isReservedWord(name)) {
const modelName = 'Model' + name
log.warn(
`${name} (reserved word) cannot be used as model name. Renamed to ${modelName}`
)
return modelName
}
if (name.match('^\\d.*')) {
const modelName = 'Model' + name
log.warn(
`${name} (model name starts with number) cannot be used as model name. Renamed to ${modelName}`
)
return modelName
}
return name
}
const tryNewRequire = mod => {
try {
const Clz = require(mod).default
return new Clz()
} catch (e) {
log.warn(`could not require ${mod}. error: ${e}`)
}
}
export const SEARCH_PATH = [path.join(__dirname, '..', '..', 'resources')]
}
if (
excludeNativeImpl &&
packageJson.ern.moduleType === ModuleTypes.NATIVE_API_IMPL
) {
continue
}
const api = {
apiName,
apiVariableName: utils.camelize(apiName, true),
hasConfig: containerGenConfig.hasConfig,
}
mustacheView.apiImplementations.push(api)
}
} else {
log.warn(
`!!!!! containerGen entry not valid for api implementation, skipping api-impl code gen in container for ${
packageJson.name
} !!!!`
)
}
}
conflictingDependencies.foreach(p => log.warn(`- ${p}`))
log.warn('Ignoring due to the use of the --force flag')
name = name + '_' + this.modelNameSuffix
}
if (!StringUtils.isEmpty(this.modelNamePrefix)) {
name = this.modelNamePrefix + '_' + name
}
name = DefaultCodegen.camelize(name)
if (this.isReservedWord(name)) {
const modelName = 'Model' + name
log.warn(
`${name} (reserved word) cannot be used as model name. Renamed to ${modelName}`
)
return modelName
}
if (name.match('^\\d.*')) {
const modelName = 'Model' + name
log.warn(
`${name} (model name starts with number) cannot be used as model name. Renamed to ${modelName}`
)
return modelName
}
return name
}
platformVersion?: string
}) => {
if (manifestId) {
await logErrorAndExitIfNotSatisfied({
manifestIdExists: {
id: manifestId,
},
})
}
const plugin = await manifest.getNativeDependency(
PackagePath.fromString(name),
{ manifestId, platformVersion }
)
if (!plugin) {
return log.warn(
`No plugin named ${name} was found for platform version ${platformVersion}`
)
}
log.info(
`${chalk.yellow(plugin.basePath)}@${chalk.magenta(plugin.version || '?')}`
)
}