Skip to content

Conversation

@ePaul
Copy link
Contributor

@ePaul ePaul commented Mar 10, 2017

PR checklist

  • Read the contribution guildelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change.
    → bin/flash-petstore.sh
  • Filed the PR against the correct branch: master for non-breaking changes.

Description of the PR

This fixes (or hopes to fix) part of #4898 for the flash generator.

The problem likely occurred when a path, query or header parameter name (as declared in the OpenAPI definition) is of a form which doesn't match the form used in Flash, or is a reserved word there. In this case the parameter gets renamed for use in the code, and the algorithm for creating the actual path tries to replace the renamed parameter in the path (which will do nothing), not the original one (which would be correct). For query or header parameters, the parameter will be sent with the sanitized name instead of the original one.

This commit changes the replacement to using {{baseName}} (which is the original name of the parameter definition as parsed from the API definition) instead of {{paramName}} (which is the sanitized version of the parameter name).

Our Petstore sample API definition doesn't seem to contain any path or query parameter which would get modified by the sanitation, so the regenerated samples just have a single difference in a header parameter (which looks better now to me).

I don't know anything about Flash, so this needs review by Flash experts. /cc @glederrey

@wing328
Copy link
Contributor

wing328 commented Mar 12, 2017

@ePaul thanks for the fix, which looks good to me (although I'm no expert in ActionScript).

@wing328 wing328 merged commit 16adc7b into swagger-api:master Mar 12, 2017
@ePaul ePaul deleted the fix-partially-4898-for-flash branch March 12, 2017 10:29
@wing328 wing328 changed the title Fix (partially) #4898 for flash [Flash/ActionScript] Fix parameter names with {{baseName Mar 12, 2017
@wing328 wing328 changed the title [Flash/ActionScript] Fix parameter names with {{baseName [Flash/ActionScript] Fix parameter names with {{baseName}} Mar 12, 2017
@glederrey
Copy link
Contributor

@ePaul Sadly, I'm not an expert in ActionScript either. I just used this language for a small project during my internship. Sorry.

spr3nk3ls pushed a commit to spr3nk3ls/swagger-codegen that referenced this pull request Mar 28, 2017
* Fix (partially) swagger-api#4898 for flash.

This fixes path, query and header parameters.

* Update samples for flash (after partial fix for swagger-api#4898).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants