Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[csharp] Default folder structure #2752

Merged
merged 5 commits into from
May 7, 2016

Conversation

jimschubert
Copy link
Contributor

@jimschubert jimschubert commented May 2, 2016

This should be considered a breaking change.

Aligns C# project outputs more with community accepted standards and leverages Nuget for package management.

This also moves the generated C# sample code out of the test project's Lib folder. The output structure here was causing some issues with maintainability (e.g. had to update test project with generated code).

(see: https://gist.github.com/davidfowl/ed7564297c61fe9ab814)

Output for a project, IO.Swagger will now look like:

    .
    ├── IO.Swagger.sln
    ├── README.md
    ├── bin
    ├── build.bat
    ├── build.sh
    ├── docs
    ├── packages
    └── src
        ├── IO.Swagger
        │   └── packages.config
        └── IO.Swagger.Test
            └── packages.config

This is a change from the Java-like src/main/csharp/IO/Swagger/etc structure and will be a breaking change for some.

@wing328

Aligns C# project outputs more with community accepted standards and
leverges Nuget for package management.

This also moves the generated C# sample code out of the test project's
Lib folder. The output structure here was causing some issues with
maintainability (e.g. had to update test project with generated code).

(see: https://gist.github.com/davidfowl/ed7564297c61fe9ab814)
Output for a project, IO.Swagger will now look like:

    .
    ├── IO.Swagger.sln
    ├── README.md
    ├── bin
    ├── build.bat
    ├── build.sh
    ├── docs
    ├── packages
    └── src
        ├── IO.Swagger
        │   └── packages.config
        └── IO.Swagger.Test
            └── packages.config

This is a change from the Java-like src/main/csharp/IO/Swagger/etc
structure and will be a breaking change for some.
In this commit, FormatTest.cs was modified manually. Unrelated to this
commit, a Guid with default parameter of null was not marked nullable.
@wing328
Copy link
Contributor

wing328 commented May 3, 2016

@jimschubert thanks for the PR. I've flagged this as a breaking change (without fallback)

I'll review and let you know if I've any questions.

(no need to rebase for now)

Possible breaking change.

optionalProjectFileFlag handles the generation of csproj and sln
files. Not modifying the plurality of the option to reduce the
impact of the breaking change for existing settings:

optionalProjectFileFlag=true
    => generates additional .sln file
optionalProjectFileFlag=false
    => no change
unspecified
    => additional files (csproj, sln) may overwrite existing files
@wing328 wing328 merged commit 9b1d43c into swagger-api:master May 7, 2016
@wing328
Copy link
Contributor

wing328 commented May 7, 2016

PR merged into master. Thanks again for the contribution.

@jimschubert jimschubert deleted the csharp_default_paths branch May 7, 2016 12:04
@jimschubert
Copy link
Contributor Author

@wing328 minor typo.

Should be using "IO.Swagger" or the files in the tree should be updated to Swagger.IO to avoid confusion. I think I ran tree on the output generated from ./bin/csharp-petstore.sh. Maybe the target project name in that script and the batch script should also be updated to be the more C# standard Swagger.IO?

@wing328
Copy link
Contributor

wing328 commented May 13, 2016

@jimschubert what about changing the default namespace to just Swagger?

In the coming weekend, I'll also move those test cases for PetStore to the auto-generated test files (which won't be overwritten if the test file already exists).

@jimschubert
Copy link
Contributor Author

I think that's fine. However, if you rename the project after moving your test cases, they will be lost if the API naming convention ever changes (*Api to *Service for example). I think keeping them in a project that doesn't get auto generated is more maintainable because it would just take a search and replace to update it.

Also, we could use the test project to include integration tests for bugs as a regression suite. I don't know that those would belong in the generated tests?

@wing328
Copy link
Contributor

wing328 commented May 16, 2016

Upgrade note from 2.1.6 to 2.2.0

Starting from 2.2.0, we've introduced the following breaking changes for C# API client:

  • compile-mono.sh has been renamed to build.sh
  • compile.bat has been renamed to build.bat
  • Solution (.sln) and project (.csproj) files are generated by default. To skip it, set optionalProjectFileFlag=false
  • New folder structure, using "IO.Swagger" as an example:

screen shot 2016-05-16 at 3 08 19 pm

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.

2 participants