Comments (7)
I think the renaming of members
to properties
is correct here (to get a valid JSON Schema object from the aws-sdk "Shape") and the renaming of member
to items
is also correct - even though we do it somewhat naively. What seems to be missing is an xmlObject
to tell OpenAPI tools that the individual array items should be wrapped in <member></member>
tags.
What I don't know is whether this is the case for all xml-based AWS APIs, so paging @pimterry in case we need to refine the logic further.
from aws2openapi.
The AWS APIs on GitHub are updated now, it will take about 35 minutes for the CI job to finish to publish them to the APIs-Guru API.
from aws2openapi.
Based on these openapi docs, it looks like the xml.name
member that you added in this commit actually changes the name rather than adding a new sub object when you have it on its own.
Although looking further down that page, I think if you also add wrapped : true
it will work.
from aws2openapi.
The xml.name
is set on the items of the array, not on the array itself, where xml.wrapped
would be set.
from aws2openapi.
Ah, so will setting xml.name
on array items that are otherwise unnamed cause the items to be wrapped in another sub-object? I don't see anything here about it (this was just a quick search, and I don't know all the options for sure). The xml.wrapped
option looks like it was for this case on the array itself, but if naming the sub objects does it too then that's perfect.
from aws2openapi.
What I don't know is whether this is the case for all xml-based AWS APIs, so paging @pimterry in case we need to refine the logic further.
In short: I have no idea 😃. I've done some digging though.
Your fix here is above for both query
and rest-xml
protocols. There are a few other interesting examples of each, so picking through a few of them rest-xml
protocol AWS docs:
Route53 (rest-xml
):
The AWS response example includes:
<DelegationSet>
<NameServers>
<NameServer>ns-2048.awsdns-64.com</NameServer>
<NameServer>ns-2049.awsdns-65.net</NameServer>
<NameServer>ns-2050.awsdns-66.org</NameServer>
<NameServer>ns-2051.awsdns-67.co.uk</NameServer>
</NameServers>
</DelegationSet>
I.e. with no <member>
tag. That doesn't match our latest OpenAPI spec, which now sets name: 'member'
. The AWS spec for this looks like:
"S2m": {
"type": "structure",
"required": [
"NameServers"
],
"members": {
"Id": {},
"CallerReference": {},
"NameServers": {
"type": "list",
"member": {
"locationName": "NameServer"
}
}
}
},
Cloudfront (rest-xml
):
Similarly the AWS docs for ListTagsForResource shows a response like:
<Tags>
<Items>
<Tag>
<Key>string</Key>
<Value>string</Value>
</Tag>
</Items>
</Tags>
Again no <member>
, and again our OpenAPI spec now includes sets name: member
. The AWS spec for this case looks like:
"TagList": {
"type": "list",
"member": {
"shape": "Tag",
"locationName": "Tag"
}
},
ELB (query
with an XML namespace):
Looking at the response from DescribeLoadBalancers for example, it seems like every ELB list uses <member>
wrappers. Notably the AWS spec doesn't use locationName
anywhere. I think the spec that comes out here is correct.
IAM (the original issue) is also using the query
protocol.
So, maybe we should actually only do this for the XML query
protocol? It's possible that it's relevant to rest-xml
but only when an explicit locationName
isn't provided, but I can't see any cases where that happens, so maybe not. Any other counter/supporting examples would be very interesting.
from aws2openapi.
Well I can at least confirm with awscurl that this is what actually gets returned for that cloudfront request (and it has no "members", as described):
$ awscurl --service cloudfront "https://cloudfront.amazonaws.com/2019-03-26/tagging/?Resource=arn%3Aaws%3Acloudfront%3A%ID%3Adistribution%ID"
<?xml version="1.0"?>
<Tags xmlns="http://cloudfront.amazonaws.com/doc/2019-03-26/"><Items><Tag><Key>test</Key><Value>value</Value></Tag></Items></Tags>
from aws2openapi.
Related Issues (20)
- Duplicate Operation Paging Parameters in S3
- The info.contact.x-twitter field causes openapi-generator to fail HOT 7
- Add tests using moto and pyopenapi HOT 6
- Unexpected "get" requests in generated openapi spec HOT 2
- text/xml in iam spec instead of application/xml, which is what the OpenAPI 3.0 spec supports HOT 3
- The "operationId" field shouldn't have spaces HOT 2
- Converter missing response mappings HOT 1
- x-amz-meta- is wrong for AWS S3 PutObject API HOT 1
- Body in PutObject, UploadPart API's type should by string instead of object HOT 2
- Wrong error response for HeadObject in s3 HOT 3
- S3 API's error not handled correctly HOT 1
- Incorrect usage of additional properties besides $ref for EC2 OpenAPI3 Swagger file HOT 1
- Openapi for endpoints that have pagination end up with duplicate parameters HOT 1
- Incorrect variable type defined in the yaml file
- unexpected multi-type 'allOff' references in runtime.lex.v2 spec
- Query parameters array "serialization" strategy HOT 5
- Support signatureVersion: bearer
- Exception definitions not included
- Duplicate entries in Servers Object
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws2openapi.