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

Add Apache v2 license to auto-generated files #2963

Closed
12 of 26 tasks
wing328 opened this issue May 25, 2016 · 20 comments
Closed
12 of 26 tasks

Add Apache v2 license to auto-generated files #2963

wing328 opened this issue May 25, 2016 · 20 comments

Comments

@wing328
Copy link
Contributor

wing328 commented May 25, 2016

We will update the auto-generated files for all languages (both API clients and server stubs).
#2960 for C# API client is a good reference.

API clients

Server stubs

@ePaul
Copy link
Contributor

ePaul commented May 25, 2016

Is this needed for some legal reason? Also, is this legally sound?

One could say that the generated code is derived from both the template files (which certainly have the same license as the rest of this project) and the API definition – the latter one is provided by the user, and could have conflicting licensing requirements (e.g. a copyleft license as GPL). In that case I guess the generated code would need to be GPL, too (or the user would not be allowed to use the generator).

@wing328
Copy link
Contributor Author

wing328 commented May 26, 2016

@ePaul thanks for your questions and please refer to the following discussion for more information.

https://groups.google.com/forum/#!searchin/swagger-swaggersocket/license/swagger-swaggersocket/6JcsR4mWpYk/pd3__T0mHwAJ

https://twitter.com/TimHaines/status/729717172889489408

Disclaimer: I'm no expert in software licensing

@ePaul
Copy link
Contributor

ePaul commented May 26, 2016

@wing328 Thanks. Just for the future, it would be nice if (in cases there has been some discussion) this discussion is linked right when the issue is opened, so people know why stuff is done.

@wing328
Copy link
Contributor Author

wing328 commented May 26, 2016

Yup, definitely valid point. I've been trying my best to keep the community informed but sometimes I did miss it. Feel free to ask whenever you've questions for us.

@xtoddx
Copy link

xtoddx commented Jun 6, 2016

tl;dr: You should license the template files Apache 2, but not assume it applies it to the resulting generated code.

The reasoning in the linked discussions is not sound. Swift is licensed Apache 2, but not every application built using the swift compiler is infected with the same license. Only the most viral licenses work this way, and Apache is not one of them. In the same way, since the templates are processed and the generated code represents a new product, the license does not persist. I'm not a lawyer, but this seems to be the intent of the license and of the swagger team.

If you make an exception (making Apache viral across swagger-codegen use) and put the license on the generated code, it isn't as simple as "do what you want". You must state changes, grant use of patents, and otherwise comply with the terms of the Apache License.... otherwise what you have is just some comments in a header and not really a license. The output code is also possibly further restricted in use by the input swagger definition, which may be incompatible with Apache 2 or not be relicensable. Specifically, Mozilla and GPL* are not relicensable (but I don't know if people actually license their swagger defs under those licenses, though I imagine AGPL is likely to come up).

Putting the Apache 2 license in the resulting files:

  • is against the stated "do what you want" position of some of the swagger team
  • makes the Apache 2 license more viral than it really is
  • ignores other licensing constraints on the generated code
  • makes adoption less likely in risk-averse institutions
  • rolls back community precedent for generated code/objects w/r/t licensing (using GCC stops the GPL3 infection in most circumstances)

At the end of the day, putting the license in the generated code violates user expectations, is probably not the intent of the license or the developers, and makes adoption more risky/complicated.

@janxious
Copy link
Contributor

janxious commented Aug 5, 2016

My reaction now on my second time trying to run new versions with this change on some gem code. I didn't share it the first time because I thought I did something wrong, and wanted to try again, but now I have so:

This change sucks. Now if I'm trying to trace some bug in the generated code I have to go through 14(+?) lines of license bullshit no matter what file I open. LIke… even .gitignore? Why is it so crazy to just stick one LICENSE file in the generated repo and be done?

Can I opt out? I looked at all the PRs that seemed relevant and it's all or nothing seemingly. I'm conflicted because swagger is a great piece of software, but I don't even see an option to include my company's copyright on generated works. Every damn file is just "this was generated by swagger, here's the apache license header enjoy". Like, how is that useful? Also it seems inconsistent that the README doesn't include this license header. It's in the same boat as every other file yet it gets a pass? As long as you're throwing out the reasonability baby, why not also throw out the reasonability bathwater?

@MitchellBurton
Copy link

MitchellBurton commented Aug 29, 2016

I would like to second @xtoddx's sentiment. This is tantamount to my compiler or code editor enforcing a licence on the code I write.

It is claimed that I can "do what you want" with the generated code, but there is no documentation telling me that I can "do what you want" with the code other than a tweet and some hard to find Github issues.

The files themselves say: "may not use this file except in compliance with the License". I cannot find the part of the Apache License that allows you to remove the license, because it doesn't exist. So i cannot do what ever I want, because that would violate the license.

Do I now have to write tests to make sure that any Apache License is removed before I publish the generated library?

This makes it very difficult to use swagger-codegen as anything other than a toy.

Suggestions:

  • If you believe that the Apache License will infect the generated code, then stop using the Apache License.
  • Add a section disclaiming any and all rights and ownership over the generated code.
  • Take a look at how swig handle it.
  • GNU thinks that the GPL does not have this problem:

In what cases is the output of a GPL program covered by the GPL too?

Is there some way that I can GPL the output people get from use of my program? For example, if my program is used to develop hardware designs, can I require that these designs must be free?

In general this is legally impossible; copyright law does not give you any say in the use of the output people make from their data using your program. If the user uses your program to enter or convert her own data, the copyright on the output belongs to her, not you. More generally, when a program translates its input into some other form, the copyright status of the output inherits that of the input it was generated from.

It goes on to say that:

The exception would be when the program displays a full screen of text and/or art that comes from the program. Then the copyright on that text and/or art covers the output. Programs that output audio, such as video games, would also fit into this exception.

I'm not clear on the internals of swagger-codegen, does it fill in templates? Does it just fill in the template and copy it out? If so then take a look a Bison and do what they did: http://www.gnu.org/software/bison/manual/html_node/Conditions.html

I know copyright and licensing can be difficult, especially in an international context, but this is really important.

@fehguy
Copy link
Contributor

fehguy commented Aug 29, 2016

Well, to be clear, the intent is that you can do anything you want with the generated files, period. This is no trick, but if someone wants to get a legal opinion on how to update the repository to make this 100% clear, I'd be happy to see if we can follow their recommendations.

Saying that the templates must have the license in them is silly. You can use your own templates with the -t argument. Does that mean that you're now in compliance if your templates have the headers in them? Does it make the project out of compliance?

We can add something in the LICENSE file to make it clear that "all included templates are covered by the Apache 2.0 license" if that helps. But we either need to agree that the intent of this project is clear, or we need a lawyer's opinion.

@wearpants
Copy link

wearpants commented Aug 29, 2016

You need a lawyer's opinion. Open Source Institute or Software Freedom Conservancy would be good choice for a consultation and probably at no cost.

@wing328
Copy link
Contributor Author

wing328 commented Sep 2, 2016

@wearpants thanks for the suggestion. I've contacted Software Freedom Conservancy to get their view/opinion on this as well.

@janslow
Copy link

janslow commented Oct 11, 2016

Is there any follow up on being able to remove the Apache license in generated code? I'm using a custom template, so I don't want to be forced to use the Apache license with the generated library.

@wing328
Copy link
Contributor Author

wing328 commented Oct 13, 2016

Yes, I reached out to Software Freedom Conservancy via email (like 2 months ago) but no reply (maybe they're very busy)

I believe Tony has engaged Open Source Institute to review but I foresee it would take some time to see some progress.

@fehguy
Copy link
Contributor

fehguy commented Oct 13, 2016

Yes, as @wing328 the Linux Foundation legal team is reviewing this. I will report back.

@jodoglevy
Copy link

jodoglevy commented Nov 2, 2016

Hi - any updates on the Linux Foundation review?

My specific questions are in #4104, but I wanted to check if I could use the above statement from @fehguy as official guidance from the Swagger team:

Well, to be clear, the intent is that you can do anything you want with the generated files, period

Does this mean that we are free to modify the provided template files as we see fit, for our own use cases? And that we are free to remove the Apache 2.0 license terms / SmartBear copyright notice from our versions of the template files, so that those terms don't appear in our generated libraries?

@fehguy
Copy link
Contributor

fehguy commented Nov 2, 2016

I will ping them again, it has been slow going...

It is my intent that you can indeed remove the copyright from the templates and therefore the generated files. I want to make sure the license interpretation lines up with that--let me see if I can get an answer.

@fehguy
Copy link
Contributor

fehguy commented Nov 4, 2016

Folks, I had another interaction with the Linux Foundation leaders. Their suggestion: ask your lawyer.

I understand the confusion and some changes that were made in the generation can also aggravate it. This project has been as a service to users of the Swagger / Open API Specification and has no intent in controlling what you do with the generated files, period.

I will update the README to make this clear. I will also suggest that, like has been asked, there should be no generated LICENSE file in any clients. Finally, the README will state that the templates are apache 2.0 licensed and that the derived files are subject to the licensing of your choice. This is like ProGuard--the code is yours after you generate it, period.

@wing328
Copy link
Contributor Author

wing328 commented Nov 7, 2016

Thanks Tony. I've filed #4149 to demostrate how to remove the license for a generator (Ruby API client as an example).

What I would suggest is to provide instruction for users to customize the license instead (while keeping Apache 2.0 as the default):

  1. update the LICENSE file that comes with all languages: modules/swagger-codegen/src/main/resources/_common/LICENSE

  2. update the mustache partial (e.g. https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/csharp/partial_header.mustache for C# API client), which is reused in API, model and other mustache files.

and then generate the code using -t option to provide the customized template.

That way users can more easily customize the license of the auto-generated code by simply replacing Apache 2.0 license with other license of their choice in just 2 files.

@wing328
Copy link
Contributor Author

wing328 commented Nov 10, 2016

As discussed with Tony, we'll completely remove all the license-related text in the auto-generated code and I'll write up a tutorial on how to customize swagger codegen to generate code with software license based on user's choice.

ETA: next Wed (Nov 16)

@wing328
Copy link
Contributor Author

wing328 commented Dec 15, 2016

Licence text has been removed. Closing this.

@SidneyAn
Copy link

As discussed with Tony, we'll completely remove all the license-related text in the auto-generated code and I'll write up a tutorial on how to customize swagger codegen to generate code with software license based on user's choice.

ETA: next Wed (Nov 16)

@wing328 could you share the link of tutorial mentioned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants