cloudendpoints / endpoints-java

A Java framework for building RESTful APIs on Google App Engine
Apache License 2.0
32 stars 35 forks source link

Generate proper API description for Map types using "additionalProperties" #155

Closed clementdenis closed 6 years ago

clementdenis commented 6 years ago

This PR changes the way Cloud Endpoints handles Map types when generating API specs:

This introduces backward incompatible changes to the generated Java clients, and the stricter validation of acceptable Map types can make some APIs fail to generate the spec. Legacy behavior can be reintroduced for both of these using flags in MapSchemaFlag (see FORCE_JSON_MAP_SCHEMA and IGNORE_UNSUPPORTED_KEY_TYPES).

A note about Map types with array-like values:

I previously opened an issue about this: https://github.com/cloudendpoints/endpoints-java/issues/142

codecov-io commented 6 years ago

Codecov Report

Merging #155 into master will increase coverage by 0.13%. The diff coverage is 91.8%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #155      +/-   ##
============================================
+ Coverage     80.12%   80.26%   +0.13%     
- Complexity     1689     1711      +22     
============================================
  Files           157      158       +1     
  Lines          5629     5684      +55     
  Branches        735      748      +13     
============================================
+ Hits           4510     4562      +52     
- Misses          838      840       +2     
- Partials        281      282       +1
Impacted Files Coverage Δ Complexity Δ
...com/google/api/server/spi/config/model/Schema.java 100% <ø> (ø) 2 <0> (ø) :arrow_down:
...e/api/server/spi/discovery/DiscoveryGenerator.java 88.93% <100%> (+0.09%) 64 <0> (+1) :arrow_up:
...oogle/api/server/spi/swagger/SwaggerGenerator.java 77.91% <100%> (+0.67%) 59 <0> (+3) :arrow_up:
.../com/google/api/server/spi/config/model/Types.java 90% <77.77%> (-2.69%) 32 <3> (+3)
...gle/api/server/spi/config/model/MapSchemaFlag.java 90.9% <90.9%> (ø) 4 <4> (?)
.../api/server/spi/config/model/SchemaRepository.java 92.42% <94.28%> (+0.26%) 38 <8> (+10) :arrow_up:
.../server/spi/discovery/CommonPathPrefixBuilder.java 100% <0%> (+5.55%) 9% <0%> (+1%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 413e434...7cb5035. Read the comment docs.

tangiel commented 6 years ago

Looks like there is a conflict now (may have merged out of order)

clementdenis commented 6 years ago

I rebased from latest master (conflict was only in imports).

clementdenis commented 6 years ago

I fixed formatting and copyright issues.