Esempio n. 1
0
 private void GenerateSchemas(IDictionary <string, OpenApiSchema> schemas, TypeList typeList)
 {
     foreach (var pair in schemas)
     {
         var type = GenerateSchema(_naming.SchemaType(pair.Key), typeList);
         typeList.Add(pair.Value, type);
     }
 }
Esempio n. 2
0
        public ITypeList Generate([NotNull] EndpointList endpoints, IDictionary <string, OpenApiSchema> schemas)
        {
            var typeList = new TypeList();

            GenerateSchemas(schemas, typeList);

            var entryEndpoint = GenerateEntryEndpoint();

            entryEndpoint.Properties.AddRange(GenerateEndpoints(endpoints, typeList));
            typeList.Add(new Endpoint(), entryEndpoint);

            return(typeList);
        }
Esempio n. 3
0
        private CSharpClass GenerateEndpointImplementation(string key, IEndpoint endpoint, TypeList typeList, IList <CSharpProperty> children)
        {
            var builder = _builders[endpoint.GetType()];

            var endpointImplementation = new CSharpClass(_naming.EndpointType(key, endpoint))
            {
                BaseClass   = builder.GetConstruction(endpoint, typeList),
                Description = endpoint.Description
            };

            endpointImplementation.Properties.AddRange(children);

            typeList.Add(endpoint, endpointImplementation);
            return(endpointImplementation);
        }
Esempio n. 4
0
        private CSharpInterface GenerateEndpointInterface(IEndpoint endpoint, TypeList typeList, CSharpClass endpointImplementation)
        {
            var builder = _builders[endpoint.GetType()];

            var endpointInterface = new CSharpInterface(endpointImplementation.Identifier.ToInterface())
            {
                Interfaces  = { builder.GetInterface(endpoint, typeList) },
                Description = endpoint.Description
            };

            endpointInterface.Properties.AddRange(endpointImplementation.Properties);

            endpointImplementation.Interfaces.Add(endpointInterface.Identifier);

            typeList.Add(endpoint, endpointInterface);
            return(endpointInterface);
        }