Code Monkey home page Code Monkey logo

Comments (5)

MikeRalphson avatar MikeRalphson commented on May 26, 2024

@pimterry do you have a view, as you're closer to these APIs than I am?

from aws2openapi.

pimterry avatar pimterry commented on May 26, 2024

Interesting, yes this is definitely an artefact of our spec generation.

We build these parameters by looking at the paginators file for the API, getting the parameter names from there, and adding them to the list of params if they're not already present. They are already present though, clearly, but mismatched because the locationName of these params (which should be the name they're sent under) is in camelCase for some reason. Not clear why.

The actual spec for this endpoint (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSpotFleetRequests.html) does list them as MaxResults and NextToken though, so perhaps uppercase is the correct format, and locationName isn't being used as I thought here.

I think there's a couple of possible options:

  • Maybe the API does actually accept both. We could include both, or pick one format and stick to it. As far as I know, there's no way to define case-insensitive parameter names with OpenAPI (unless you know better @MikeRalphson?). If we want to pick only one, I'd lean towards using the publicly documented format (TitleCase).
  • Maybe the API actually only accepts one, and our parsing is wrong. That'd mean either:
    • We're misunderstanding how the param is really sent, and locationName isn't being used here (i.e. the real param is uppercase)
    • We're misunderstanding how the paginators file is used, and the names there refer to param keys in the input shape, not the query param names (i.e. the real param is lowercase, and the docs are wrong/confusing).

I'm going to dig into it, hopefully later today, and try to work out which of those cases this is. Any ideas in the meantime very welcome!

from aws2openapi.

MikeRalphson avatar MikeRalphson commented on May 26, 2024

Thanks! As you suspect, there's no way to indicate case-insensitive parameter name matching in OAS.

from aws2openapi.

pimterry avatar pimterry commented on May 26, 2024

Ok, conclusion:

  • The param is indeed supposed to be TitleCase.
  • We were interpreting the parameter spec wrong. The ec2 protocol does use the same mechanism for query serialization as the query protocol, but has a bonus special case for parameter naming: https://github.com/aws/aws-sdk-js/blob/master/lib/query/query_param_serializer.js#L10-L16
  • I've opened #20, which fixes this by generating names that do follow this bonus rule. Just generating the names correctly fixes the issue, as the pagination logic now correctly spots that the parameter already exists.

Thanks for reporting this @ggallotti! It applies to all the other EC2 params too, so it's actually a general issue with the EC2 specs that I'd totally missed 👍

from aws2openapi.

ggallotti avatar ggallotti commented on May 26, 2024

Great!
Thanks both for your time at resolving this Issue.

from aws2openapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.