public OpenApiServiceShould()
        {
            _openApiService             = OpenApiDocumentCreatorMock.GetOpenApiService(ConfigFilePath);
            _openAPIDocumentCreatorMock = new OpenApiDocumentCreatorMock(_openApiService);

            // Create OpenAPI document with default OpenApiStyle = Plain
            _graphMockSource = _openAPIDocumentCreatorMock.GetGraphOpenApiDocument("Mock", false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenApiServiceOperation"/> class.
        /// </summary>
        /// <param name="service">The service hosting the operation.</param>
        /// <param name="operation">The operation.</param>
        /// <param name="configuration">The OpenAPI configuration.</param>
        public OpenApiServiceOperation(IOpenApiService service, MethodInfo operation, IOpenApiConfiguration configuration)
        {
            this.service       = service ?? throw new ArgumentNullException(nameof(service));
            this.operation     = operation ?? throw new ArgumentNullException(nameof(operation));
            this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            ParameterInfo[] parameters = this.operation.GetParameters();
            this.defaultValues    = new object[parameters.Length];
            this.hasDefaultValues = new bool[parameters.Length];
            this.parameterNames   = new string[parameters.Length];

            for (int i = 0; i < parameters.Length; ++i)
            {
                ParameterInfo parameter = parameters[i];

                if (parameter.HasDefaultValue)
                {
                    this.hasDefaultValues[i] = true;
                    this.defaultValues[i]    = parameter.DefaultValue;
                }

                OpenApiParameterAttribute parameterAttribute = parameter.GetCustomAttribute <OpenApiParameterAttribute>();
                this.parameterNames[i] = parameterAttribute?.ParameterName ?? parameter.Name;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new instance of the SwaggerFunction type.
 /// </summary>
 /// <param name="openApiService">The service implementation to use.</param>
 public OpenApiFunction(IOpenApiService openApiService)
 {
     _openApiService = openApiService;
 }
Exemplo n.º 4
0
 public OpenApiController(IUserAppServices userAppServices, IConfiguration configuration, IOpenApiService openApi)
 {
     _userAppServices = userAppServices;
     _configuration   = configuration;
     _openApi         = openApi;
 }
Exemplo n.º 5
0
 public ConnectApiHostedService(IOpenApiService apiService, ApiCredentials apiCredentials)
 {
     _apiService     = apiService;
     _apiCredentials = apiCredentials;
 }