public WebApiGeneratorModel BuildModel()
		{
			classesNames = new Collection<string>();
			warnings = new Dictionary<string, string>();
            enums = new Dictionary<string, ApiEnum>();

			schemaRequestObjects = GetRequestObjects();
			schemaResponseObjects = GetResponseObjects();

			CleanProperties(schemaRequestObjects);
			CleanProperties(schemaResponseObjects);

            webApiMethodsGenerator = new WebApiMethodsGenerator(raml, schemaResponseObjects, schemaRequestObjects, linkKeysWithObjectNames);

			var controllers = GetControllers().ToArray();

			CleanNotUsedObjects(controllers);

			return new WebApiGeneratorModel
			       {
					   Namespace = NetNamingMapper.GetNamespace(raml.Title),
				       Controllers = controllers,
					   RequestObjects = schemaRequestObjects,
					   ResponseObjects = schemaResponseObjects,
                       Warnings = warnings,
                       Enums = Enums
			       };
		}
        public WebApiGeneratorModel BuildModel()
        {
            classesNames = new Collection <string>();
            warnings     = new Dictionary <string, string>();
            enums        = new Dictionary <string, ApiEnum>();

            ParseSchemas();
            schemaRequestObjects  = GetRequestObjects();
            schemaResponseObjects = GetResponseObjects();

            CleanProperties(schemaObjects);
            CleanProperties(schemaRequestObjects);
            CleanProperties(schemaResponseObjects);

            webApiMethodsGenerator = new WebApiMethodsGenerator(raml, schemaResponseObjects, schemaRequestObjects, linkKeysWithObjectNames, schemaObjects);

            var controllers = GetControllers().ToArray();

            CleanNotUsedObjects(controllers);

            return(new WebApiGeneratorModel
            {
                Namespace = NetNamingMapper.GetNamespace(raml.Title),
                Controllers = controllers,
                SchemaObjects = schemaObjects,
                RequestObjects = schemaRequestObjects,
                ResponseObjects = schemaResponseObjects,
                Warnings = warnings,
                Enums = Enums
            });
        }
Ejemplo n.º 3
0
        public WebApiGeneratorModel BuildModel()
        {
            classesNames = new Collection <string>();
            warnings     = new Dictionary <string, string>();
            enums        = new Dictionary <string, ApiEnum>();

            //new RamlTypeParser(raml.Shapes, schemaObjects, ns, enums, warnings).Parse();

            ParseSchemas();
            GetRequestObjects();
            schemaResponseObjects = GetResponseObjects();

            //CleanProperties(schemaObjects);
            //CleanProperties(schemaRequestObjects);
            //CleanProperties(schemaResponseObjects);

            HandleScalarTypes();

            if (raml.WebApi == null)
            {
                return(new WebApiGeneratorModel
                {
                    ControllersNamespace = controllersNamespace,
                    ModelsNamespace = modelsNamespace,
                    SchemaObjects = schemaObjects,
                    RequestObjects = schemaRequestObjects,
                    ResponseObjects = schemaResponseObjects,
                    Warnings = warnings,
                    Enums = Enums
                });
            }

            webApiMethodsGenerator = new WebApiMethodsGenerator(raml, schemaResponseObjects, schemaRequestObjects, linkKeysWithObjectNames, schemaObjects,
                                                                enums);
            var controllers = GetControllers().ToArray();

            apiObjectsCleaner      = new ApiObjectsCleaner(schemaRequestObjects, schemaResponseObjects, schemaObjects);
            uriParametersGenerator = new UriParametersGenerator(schemaObjects);

            CleanNotUsedObjects(controllers);

            return(new WebApiGeneratorModel
            {
                ControllersNamespace = controllersNamespace,
                ModelsNamespace = modelsNamespace,
                Controllers = controllers,
                SchemaObjects = schemaObjects,
                RequestObjects = schemaRequestObjects,
                ResponseObjects = schemaResponseObjects,
                Warnings = warnings,
                Enums = Enums,
                ApiVersion = raml.WebApi.Version
            });
        }
Ejemplo n.º 4
0
        public WebApiGeneratorModel BuildModel()
        {
            classesNames = new Collection <string>();
            warnings     = new Dictionary <string, string>();
            enums        = new Dictionary <string, ApiEnum>();

            var ns = string.IsNullOrWhiteSpace(raml.Title) ? targetNamespace : NetNamingMapper.GetNamespace(raml.Title);

            new RamlTypeParser(raml.Types, schemaObjects, ns, enums, warnings).Parse();

            ParseSchemas();
            schemaRequestObjects  = GetRequestObjects();
            schemaResponseObjects = GetResponseObjects();

            CleanProperties(schemaObjects);
            CleanProperties(schemaRequestObjects);
            CleanProperties(schemaResponseObjects);

            webApiMethodsGenerator = new WebApiMethodsGenerator(raml, schemaResponseObjects, schemaRequestObjects, linkKeysWithObjectNames, schemaObjects);

            var controllers = GetControllers().ToArray();

            CleanNotUsedObjects(controllers);


            return(new WebApiGeneratorModel
            {
                Namespace = ns,
                Controllers = controllers,
                SchemaObjects = schemaObjects,
                RequestObjects = schemaRequestObjects,
                ResponseObjects = schemaResponseObjects,
                Warnings = warnings,
                Enums = Enums,
                ApiVersion = raml.Version
            });
        }
 public WebApiGeneratorService(RamlDocument raml) : base(raml)
 {
     webApiMethodsGenerator = new WebApiMethodsGenerator(raml);
 }