Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAPI docs are wrong for /api/v1/CoffeeCards #75

Open
TTA777 opened this issue Feb 14, 2022 · 4 comments
Open

OpenAPI docs are wrong for /api/v1/CoffeeCards #75

TTA777 opened this issue Feb 14, 2022 · 4 comments
Labels
bug Verified bug

Comments

@TTA777
Copy link
Member

TTA777 commented Feb 14, 2022

The OpenAPI doc says it returns a single CoffeeCard, though it returns an IEnumerable of CoffeeCards

@TTA777 TTA777 added the bug Verified bug label Feb 14, 2022
@jonasanker
Copy link
Member

Seems like you are right. The wrong type is documented at https://github.com/AnalogIO/analog-core/blob/develop/coffeecard/CoffeeCard.WebApi/Controllers/CoffeeCardsController.cs#L36

[HttpGet]
        [ProducesResponseType(typeof(CoffeeCardDto), StatusCodes.Status200OK)]
        [ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
        public ActionResult<CoffeeCardDto> Get()
        {
            return Ok(_ticketService.GetCoffeeCards(User.Claims));
        }

I think we are deprecating this API in v2, so maybe this is not worth spending time on.

@TTA777
Copy link
Member Author

TTA777 commented Feb 14, 2022

Wasn't sure whether we would continue using this endpoint, or the ticket's one, which is why I filed the issue. In either case, it is a very easy fix

@jonasanker
Copy link
Member

I understand. It's worth a discussion what is the optimal API for Tickets, Purchases and CoffeeCards. They are a bit mixed today and we can probably improve this in API v2.

@TTA777
Copy link
Member Author

TTA777 commented Feb 15, 2022

The way I see it, it partially comes down to where do we want the computation to take place, i.e. in the app or the database. The coffeecard endpoint gives more work to the database, in that it is a bigger query compared to the one from tickets. For the tickets one, on the other hand, we have to group the tickets by their product category in the app once we receive them.

Neither of them are perfect, since the app doesn't really need to know which tickets a user has in the database, so it gets redundant data in the tickets' endpoint. Similarly, the app doesn't really need to know which products it does not have tickets for, so it also gets redundant data in the cofeecard one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified bug
Projects
None yet
Development

No branches or pull requests

2 participants