Skip to content

Fix V2 parameter deserializer to recognize formData instead of form - #155

Merged
PerthCharern merged 6 commits into
masterfrom
PerthCharern/FixFormToFormDataAndAddBasicUnitTests
Dec 19, 2017
Merged

PerthCharern merged 6 commits into
masterfrom
PerthCharern/FixFormToFormDataAndAddBasicUnitTests

Conversation

@PerthCharern

Copy link
Copy Markdown
Contributor
  • Fix V2 parameter deserializer to recognize formData instead of form
  • Basic unit tests for all types of possible parameters in V2.

- Basic unit tests for 5 types of possible parameters in V2.
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="V2Tests\Samples\OpenApiParameter\formDataParameter.yaml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we embed this files with the test.dll?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the pros and cons of this. Darrel (@darrelmiller) also pointed this out earlier.

What's the disadvantage of not embedding a test file?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PerthCharern It just means you have to carry those files around to make the tests work. If they are embedded in the DLL then the tests are self-contained.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand the concerns now. At first I thought using a non-embedded resource with relative path should work, but that might not be the case since the test assembly can technically be run from anywhere.

Let's make this change in a separate PR for all resources.

{
using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "bodyParameter.yaml")))
{
var yamlStream = new YamlStream();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Arrange

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as others

@@ -0,0 +1,10 @@
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we include this line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should point to the source we took the YAML files from.

{
var yamlStream = new YamlStream();
yamlStream.Load(new StreamReader(stream));
var yamlNode = yamlStream.Documents.First().RootNode;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of codes are duplicated. Think to add a private method to wrapper?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into this now.

@PerthCharern

Copy link
Copy Markdown
Contributor Author

Darrel (@darrelmiller) Sam Xu (@xuzhg)

I'll take care of embedding the all test files in a separate PR. Please let me know if you guys have more comments about the changes here.

@PerthCharern
PerthCharern merged commit 00f00f0 into master Dec 19, 2017
@PerthCharern
PerthCharern deleted the PerthCharern/FixFormToFormDataAndAddBasicUnitTests branch January 25, 2018 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants