License
This page explains how the license info is generated in the client code.
Azure license
For Azure scenarios, client code will always use the MIT license and include the license info in the header of the generated code or in a separate file depending on the language.
For example, this is the license comment in the generated code of a Java client:
// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License.This is the LICENSE file of a Python client library:
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the “Software”), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.Unbranded license
For unbranded scenarios, client code will have no license info if there is no license configuration in tspconfig.yaml.
Spec authors can set the license info with the license configuration in the tspconfig.yaml:
license: name: <License name. We have built-in "MIT License", "Apache License 2.0", "BSD 3-Clause License", "MPL 2.0", "GPL-3.0", and "LGPL-3.0". For other licenses, you need to set the link, header, and description manually.> company: <Company name used in copyright> link: <License link> header: <License header in the generated code> description: <License description in the separate license file>For example, if you configure the license like the following, you will get the same license info as Azure scenarios:
emit: - "@azure-tools/typespec-python" - "@azure-tools/typespec-java"options: "@azure-tools/typespec-python": license: name: "MIT License" company: "Microsoft Corporation" "@azure-tools/typespec-java": license: name: "MIT License" company: "Microsoft Corporation"