Skip to content

OpenApiPaths and Operations #472

@fabich

Description

@fabich

Hi all
I have a question regarding OpenApiPaths and their operations:
Let's assume I have the following two endpoints:

/api/mp/v1.0/order/{ordernumber}
/api/mp/v1.0/order/{id}

Is this valid from an OpenApi spec point of view?
According to online.swagger.io and OpenApiDiagnostic this is no issue.
Whey are they not combined? Or why is this not a validation issue?
With the following example from an API point of view I don't know what has been called:
/api/mp/v1.0/order/10

code to generate OpenApi spec:

        /// <summary>
        /// Gets the resource with the specified id.
        /// </summary>
        /// <param name="id">The resource id.</param>
        /// <response code="200">The resource with the specified id.</response>
        /// <response code="404">A resource with the specified id could not be found.</response>
        [HttpGet("{id}")]
        [Authorize(PolicyNames.OrderManagement.CanRead)]
        [ProducesResponseType(typeof(OrderReadDTO), StatusCodes.Status200OK)]
        [ProducesResponseType(typeof(BaseErrorResult), StatusCodes.Status404NotFound)]
        public async Task<IActionResult> GetById(int id)
        {
            var result = await _OrderService.GetSingleAsync(id);
            return new ObjectResult(result);
        }
        /// <summary>
        /// Gets the resource with the specified order number.
        /// </summary>
        /// <param name="orderno">The resource order number.</param>
        /// <response code="200">The resource with the specified order no.</response>
        /// <response code="404">A resource with the specified order no could not be found.</response>
        [HttpGet("{orderno}")]
        [Authorize(PolicyNames.OrderManagement.CanRead)]
        [ProducesResponseType(typeof(OrderReadDTO), StatusCodes.Status200OK)]
        [ProducesResponseType(typeof(BaseErrorResult), StatusCodes.Status404NotFound)]
        public async Task<IActionResult> GetByOrderNo(int orderno)
        {
            var result = await _OrderService.GetSingleAsync(orderno);
            return new ObjectResult(result);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionAn issue that's a question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions