Esempio n. 1
0
        public static bool?DefaultIsPropertyOptional(TypeScriptGenerator generator, MetadataType type, MetadataPropertyType prop)
        {
            if (prop.Attributes.Safe().FirstOrDefault(x => x.Name == "Required") != null)
            {
                return(false);
            }

            if (generator.Config.MakePropertiesOptional)
            {
                return(true);
            }

            return(null);
        }
Esempio n. 2
0
        public static bool?DefaultIsPropertyOptional(TypeScriptGenerator generator, MetadataType type, MetadataPropertyType prop)
        {
            if (prop.IsRequired == true)
            {
                return(false);
            }

            if (generator.Config.MakePropertiesOptional)
            {
                return(true);
            }

            return(null);
        }
Esempio n. 3
0
        public object Any(TypesTypeScript request)
        {
            if (request.BaseUrl == null)
                request.BaseUrl = Request.GetBaseUrl();

            var typesConfig = NativeTypesMetadata.GetConfig(request);
    
            //Include SS types by removing ServiceStack namespaces
            if (typesConfig.AddServiceStackTypes)
                typesConfig.IgnoreTypesInNamespaces = new List<string>();

            var metadataTypes = NativeTypesMetadata.GetMetadataTypes(Request, typesConfig);

            metadataTypes.Types.RemoveAll(x => x.Name == "Service");

            if (typesConfig.AddServiceStackTypes)
            {
                //IReturn markers are metadata properties that are not included as normal interfaces
                var generator = ((NativeTypesMetadata)NativeTypesMetadata).GetMetadataTypesGenerator(typesConfig);
                metadataTypes.Types.Insert(0, generator.ToType(typeof(IReturn<>)));
                metadataTypes.Types.Insert(0, generator.ToType(typeof(IReturnVoid)));
            }
 
            var typeScript = new TypeScriptGenerator(typesConfig).GetCode(metadataTypes, base.Request, NativeTypesMetadata);
            return typeScript;
        }
        public object Any(TypesTypeScript request)
        {
            if (request.BaseUrl == null)
                request.BaseUrl = Request.GetBaseUrl();

            var typesConfig = NativeTypesMetadata.GetConfig(request);
            var metadataTypes = NativeTypesMetadata.GetMetadataTypes(Request, typesConfig);
            var csharp = new TypeScriptGenerator(typesConfig).GetCode(metadataTypes, base.Request);
            return csharp;
        }