/// <summary>Initializes a new instance of the <see cref="ResponseModelBase" /> class.</summary> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="isSuccessResponse">Specifies whether this is the success response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="settings">The settings.</param> /// <param name="generator">The client generator.</param> protected ResponseModelBase(string statusCode, SwaggerResponse response, bool isSuccessResponse, JsonSchema4 exceptionSchema, CodeGeneratorSettingsBase settings, IClientGenerator generator) { _response = response; _exceptionSchema = exceptionSchema; _generator = generator; _settings = settings; IsSuccess = isSuccessResponse; StatusCode = statusCode; }
/// <summary>Initializes a new instance of the <see cref="ResponseModelBase" /> class.</summary> /// <param name="operationModel">The operation model.</param> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="isPrimarySuccessResponse">Specifies whether this is the success response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="settings">The settings.</param> /// <param name="generator">The client generator.</param> protected ResponseModelBase(IOperationModel operationModel, string statusCode, SwaggerResponse response, bool isPrimarySuccessResponse, JsonSchema4 exceptionSchema, CodeGeneratorSettingsBase settings, IClientGenerator generator) { _response = response; _exceptionSchema = exceptionSchema; _generator = generator; _settings = settings; _isPrimarySuccessResponse = isPrimarySuccessResponse; _operationModel = operationModel; StatusCode = statusCode; }
/// <summary>Initializes a new instance of the <see cref="ParameterModelBase" /> class.</summary> /// <param name="parameterName">Name of the parameter.</param> /// <param name="variableName">Name of the variable.</param> /// <param name="typeName">The type name.</param> /// <param name="parameter">The parameter.</param> /// <param name="allParameters">All parameters.</param> /// <param name="settings">The settings.</param> /// <param name="generator">The client generator base.</param> protected ParameterModelBase(string parameterName, string variableName, string typeName, SwaggerParameter parameter, IList <SwaggerParameter> allParameters, CodeGeneratorSettingsBase settings, IClientGenerator generator) { Type = typeName; Name = parameterName; VariableName = variableName; _allParameters = allParameters; _parameter = parameter; _settings = settings; _generator = generator; }
/// <summary>Initializes a new instance of the <see cref="CSharpParameterModel" /> class.</summary> /// <param name="parameterName">Name of the parameter.</param> /// <param name="variableName">Name of the variable.</param> /// <param name="typeName">The type name.</param> /// <param name="parameter">The parameter.</param> /// <param name="allParameters">All parameters.</param> /// <param name="settings">The settings.</param> /// <param name="generator">The client generator base.</param> /// <param name="typeResolver">The type resolver.</param> public CSharpParameterModel( string parameterName, string variableName, string typeName, OpenApiParameter parameter, IList <OpenApiParameter> allParameters, CodeGeneratorSettingsBase settings, IClientGenerator generator, TypeResolverBase typeResolver) : base(parameterName, variableName, typeName, parameter, allParameters, settings, generator, typeResolver) { }
/// <summary>Initializes a new instance of the <see cref="ResponseModelBase" /> class.</summary> /// <param name="operationModel">The operation model.</param> /// <param name="operation">The operation.</param> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="isPrimarySuccessResponse">Specifies whether this is the success response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="resolver">The resolver.</param> /// <param name="settings">The settings.</param> /// <param name="generator">The client generator.</param> protected ResponseModelBase(IOperationModel operationModel, SwaggerOperation operation, string statusCode, SwaggerResponse response, bool isPrimarySuccessResponse, JsonSchema4 exceptionSchema, TypeResolverBase resolver, CodeGeneratorSettingsBase settings, IClientGenerator generator) { _response = response; _exceptionSchema = exceptionSchema; _generator = generator; _settings = settings; _resolver = resolver; _operationModel = operationModel; StatusCode = statusCode; IsPrimarySuccessResponse = isPrimarySuccessResponse; ActualResponseSchema = response.GetActualResponseSchema(operation); }
/// <summary>Initializes a new instance of the <see cref="ParameterModelBase" /> class.</summary> /// <param name="parameterName">Name of the parameter.</param> /// <param name="variableName">Name of the variable.</param> /// <param name="typeName">The type name.</param> /// <param name="parameter">The parameter.</param> /// <param name="allParameters">All parameters.</param> /// <param name="settings">The settings.</param> /// <param name="generator">The client generator base.</param> /// <param name="typeResolver">The type resolver.</param> protected ParameterModelBase(string parameterName, string variableName, string typeName, SwaggerParameter parameter, IList <SwaggerParameter> allParameters, CodeGeneratorSettingsBase settings, IClientGenerator generator, TypeResolverBase typeResolver) { _allParameters = allParameters; _parameter = parameter; _settings = settings; _generator = generator; _typeResolver = typeResolver; Type = typeName; Name = parameterName; VariableName = variableName; var propertyNameGenerator = settings?.PropertyNameGenerator ?? throw new InvalidOperationException("PropertyNameGenerator not set."); _properties = _parameter.ActualSchema.ActualProperties .Select(p => new PropertyModel(p.Key, p.Value, propertyNameGenerator.Generate(p.Value))) .ToList(); }
private void LoadGeneratoers(NSwagDocument document) { SwaggerGenerators = new ISwaggerGenerator[] { new SwaggerInputGeneratorView(Document), new WebApiSwaggerGeneratorView(Document.WebApiToSwaggerCommand), new JsonSchemaInputGeneratorView(Document), new AssemblySwaggerGeneratorView(Document.AssemblyTypeToSwaggerCommand), }; ClientGenerators = new IClientGenerator[] { new SwaggerGeneratorView(), new TypeScriptCodeGeneratorView(Document.SwaggerToTypeScriptCommand), new CSharpClientGeneratorView(Document.SwaggerToCSharpCommand) }; RaisePropertyChanged(() => SwaggerGenerators); RaisePropertyChanged(() => ClientGenerators); }
private void LoadGeneratoers(NSwagDocument document) { SwaggerGenerators = new ISwaggerGenerator[] { new SwaggerInputGeneratorView(Document), new WebApiSwaggerGeneratorView(Document.WebApiToSwaggerCommand), new JsonSchemaInputGeneratorView(Document), new AssemblySwaggerGeneratorView(Document.AssemblyTypeToSwaggerCommand), }; ClientGenerators = new IClientGenerator[] { new SwaggerGeneratorView(), new TypeScriptCodeGeneratorView(Document.SwaggerToTypeScriptCommand), new CSharpClientGeneratorView(Document.SwaggerToCSharpCommand) }; RaisePropertyChanged(() => SwaggerGenerators); RaisePropertyChanged(() => ClientGenerators); }
/// <summary>Initializes a new instance of the <see cref="OperationModelBase{TParameterModel, TResponseModel}"/> class.</summary> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="operation">The operation.</param> /// <param name="resolver">The resolver.</param> /// <param name="generator">The generator.</param> /// <param name="settings">The settings.</param> protected OperationModelBase(JsonSchema exceptionSchema, OpenApiOperation operation, TypeResolverBase resolver, IClientGenerator generator, ClientGeneratorBaseSettings settings) { _operation = operation; _resolver = resolver; _generator = generator; _settings = settings; var responses = _operation.ActualResponses .Select(response => CreateResponseModel(operation, response.Key, response.Value, exceptionSchema, generator, resolver, settings)) .ToList(); var defaultResponse = responses.SingleOrDefault(r => r.StatusCode == "default"); if (defaultResponse != null) { responses.Remove(defaultResponse); } Responses = responses; DefaultResponse = defaultResponse; }
/// <summary>Creates the response model.</summary> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The generator.</param> /// <param name="settings">The settings.</param> /// <returns>The response model.</returns> protected abstract TResponseModel CreateResponseModel(string statusCode, SwaggerResponse response, JsonSchema4 exceptionSchema, IClientGenerator generator, ClientGeneratorBaseSettings settings);
/// <summary>Creates the response model.</summary> /// <param name="operation">The operation.</param> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The generator.</param> /// <param name="resolver">The resolver.</param> /// <param name="settings">The settings.</param> /// <returns></returns> protected override TypeScriptResponseModel CreateResponseModel(SwaggerOperation operation, string statusCode, SwaggerResponse response, JsonSchema4 exceptionSchema, IClientGenerator generator, TypeResolverBase resolver, ClientGeneratorBaseSettings settings) { return(new TypeScriptResponseModel(this, operation, statusCode, response, response == GetSuccessResponse().Value, exceptionSchema, generator, resolver, (SwaggerToTypeScriptClientGeneratorSettings)settings)); }
public TypescriptClientWriter(IClientGenerator clientGenerator) { this.clientGenerator = clientGenerator; }
/// <summary>Creates the response model.</summary> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The generator.</param> /// <param name="resolver">The resolver.</param> /// <param name="settings">The settings.</param> /// <returns></returns> protected override CSharpResponseModel CreateResponseModel(string statusCode, SwaggerResponse response, JsonSchema4 exceptionSchema, IClientGenerator generator, TypeResolverBase resolver, ClientGeneratorBaseSettings settings) { return(new CSharpResponseModel(this, statusCode, response, response == GetSuccessResponse(), exceptionSchema, generator, resolver, settings.CodeGeneratorSettings)); }
/// <summary>Creates the response model.</summary> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The generator.</param> /// <param name="settings">The settings.</param> /// <returns></returns> protected override TypeScriptResponseModel CreateResponseModel(string statusCode, SwaggerResponse response, JsonSchema4 exceptionSchema, IClientGenerator generator, ClientGeneratorBaseSettings settings) { return(new TypeScriptResponseModel(statusCode, response, response == GetSuccessResponse(), exceptionSchema, generator, (TypeScriptGeneratorSettings)settings.CodeGeneratorSettings)); }
/// <summary>Initializes a new instance of the <see cref="TypeScriptResponseModel" /> class.</summary> /// <param name="operationModel">The operation model.</param> /// <param name="operation">The operation.</param> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="isPrimarySuccessResponse">if set to <c>true</c> [is success response].</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The generator.</param> /// <param name="resolver">The resolver.</param> /// <param name="settings">The settings.</param> public TypeScriptResponseModel(IOperationModel operationModel, OpenApiOperation operation, string statusCode, OpenApiResponse response, bool isPrimarySuccessResponse, JsonSchema exceptionSchema, IClientGenerator generator, TypeResolverBase resolver, TypeScriptClientGeneratorSettings settings) : base(operationModel, operation, statusCode, response, isPrimarySuccessResponse, exceptionSchema, resolver, settings.TypeScriptGeneratorSettings, generator) { _settings = settings; }
public CSharpClientWriter(IClientGenerator clientGenerator, CSharpOptions options) { this.clientGenerator = clientGenerator; this.options = options; }
/// <summary>Initializes a new instance of the <see cref="CSharpResponseModel"/> class.</summary> /// <param name="operationModel">The operation model.</param> /// <param name="operation">The operation.</param> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="isPrimarySuccessResponse">Specifies whether this is the success response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The client generator.</param> /// <param name="resolver">The resolver.</param> /// <param name="settings">The settings.</param> public CSharpResponseModel(IOperationModel operationModel, SwaggerOperation operation, string statusCode, SwaggerResponse response, bool isPrimarySuccessResponse, JsonSchema4 exceptionSchema, IClientGenerator generator, TypeResolverBase resolver, CodeGeneratorSettingsBase settings) : base(operationModel, operation, statusCode, response, isPrimarySuccessResponse, exceptionSchema, resolver, settings, generator) { }
/// <summary>Initializes a new instance of the <see cref="CSharpResponseModel"/> class.</summary> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="isPrimarySuccessResponse">Specifies whether this is the success response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The client generator.</param> /// <param name="settings">The settings.</param> public CSharpResponseModel(string statusCode, SwaggerResponse response, bool isPrimarySuccessResponse, JsonSchema4 exceptionSchema, IClientGenerator generator, CodeGeneratorSettingsBase settings) : base(statusCode, response, isPrimarySuccessResponse, exceptionSchema, settings, generator) { }
/// <summary>Creates the response model.</summary> /// <param name="operation">The operation.</param> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The generator.</param> /// <param name="resolver">The resolver.</param> /// <param name="settings">The settings.</param> /// <returns></returns> protected override CSharpResponseModel CreateResponseModel(OpenApiOperation operation, string statusCode, OpenApiResponse response, JsonSchema exceptionSchema, IClientGenerator generator, TypeResolverBase resolver, ClientGeneratorBaseSettings settings) { return(new CSharpResponseModel(this, operation, statusCode, response, response == GetSuccessResponse().Value, exceptionSchema, generator, resolver, settings.CodeGeneratorSettings)); }
public DotvvmCSharpParameterModel(string parameterName, string variableName, string typeName, SwaggerParameter parameter, IList <SwaggerParameter> allParameters, CodeGeneratorSettingsBase settings, IClientGenerator generator, DotvvmCSharpOperationModel operation) : base(parameterName, variableName, typeName, parameter, allParameters, settings, generator) { this.operation = operation; }
/// <summary>Creates the response model.</summary> /// <param name="operation">The operation.</param> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The generator.</param> /// <param name="resolver">The resolver.</param> /// <param name="settings">The settings.</param> /// <returns>The response model.</returns> protected abstract TResponseModel CreateResponseModel(OpenApiOperation operation, string statusCode, OpenApiResponse response, JsonSchema exceptionSchema, IClientGenerator generator, TypeResolverBase resolver, ClientGeneratorBaseSettings settings);
/// <summary>Initializes a new instance of the <see cref="CSharpParameterModel" /> class.</summary> /// <param name="parameterName">Name of the parameter.</param> /// <param name="variableName">Name of the variable.</param> /// <param name="typeName">The type name.</param> /// <param name="parameter">The parameter.</param> /// <param name="allParameters">All parameters.</param> /// <param name="settings">The settings.</param> /// <param name="generator">The client generator base.</param> public CSharpParameterModel(string parameterName, string variableName, string typeName, SwaggerParameter parameter, IList <SwaggerParameter> allParameters, CodeGeneratorSettingsBase settings, IClientGenerator generator) : base(parameterName, variableName, typeName, parameter, allParameters, settings, generator, new CSharpValueGenerator(new CSharpTypeResolver((CSharpGeneratorSettings)settings), (CSharpGeneratorSettings)settings)) { }
public PhpClientWriter(IClientGenerator clientGenerator, PhpOptions phpOptions) { this.clientGenerator = clientGenerator; this.phpOptions = phpOptions; }
/// <summary>Initializes a new instance of the <see cref="CSharpParameterModel" /> class.</summary> /// <param name="parameterName">Name of the parameter.</param> /// <param name="variableName">Name of the variable.</param> /// <param name="typeName">The type name.</param> /// <param name="parameter">The parameter.</param> /// <param name="allParameters">All parameters.</param> /// <param name="settings">The settings.</param> /// <param name="generator">The client generator base.</param> public CSharpParameterModel(string parameterName, string variableName, string typeName, SwaggerParameter parameter, IList <SwaggerParameter> allParameters, CodeGeneratorSettingsBase settings, IClientGenerator generator) : base(parameterName, variableName, typeName, parameter, allParameters, settings, generator) { }
/// <summary>Initializes a new instance of the <see cref="TypeScriptResponseModel" /> class.</summary> /// <param name="statusCode">The status code.</param> /// <param name="response">The response.</param> /// <param name="isSuccessResponse">if set to <c>true</c> [is success response].</param> /// <param name="exceptionSchema">The exception schema.</param> /// <param name="generator">The generator.</param> /// <param name="settings">The settings.</param> public TypeScriptResponseModel(string statusCode, SwaggerResponse response, bool isSuccessResponse, JsonSchema4 exceptionSchema, IClientGenerator generator, SwaggerToTypeScriptClientGeneratorSettings settings) : base(statusCode, response, isSuccessResponse, exceptionSchema, settings.TypeScriptGeneratorSettings, generator) { _settings = settings; }
public ClientGenTester(IClientGenerator clientGenerator) { this.clientGenerator = clientGenerator; }