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 the identifier field to the license object #1288

Open
irevoire opened this issue Jan 13, 2025 · 2 comments
Open

Add the identifier field to the license object #1288

irevoire opened this issue Jan 13, 2025 · 2 comments

Comments

@irevoire
Copy link

Hey,

One of our users noticed that the identifier field was missing in the license object: meilisearch/open-api#15

From what I see in the openAPI specification, they're right:
image

@juhaku
Copy link
Owner

juhaku commented Jan 13, 2025

The identifier was added there not long ago and should be set automatically if I remember right:

pub fn identifier<S: Into<String>>(mut self, identifier: Option<S>) -> Self {

Also it is set in the utoipa-gen by resolving it from CARGO_PKG_LICENSE field

let license = std::env::var("CARGO_PKG_LICENSE")
.ok()
.map(|spdx_expr| License {
name: Cow::Owned(spdx_expr.clone()),
// CARGO_PKG_LICENSE contains an SPDX expression as described in the Cargo Book.
// It can be set to `info.license.identifier`.
identifier: Cow::Owned(spdx_expr),
..Default::default()

It should be possible to set it via #[openapi(info(identifier = ...))] attribute as well but then the whole info need be manually added as well.

@irevoire
Copy link
Author

Ah ok, from what I understand it is already fixed but not released yet, is that correct?

It should be possible to set it via #[openapi(info(identifier = ...))] attribute as well but then the whole info need be manually added as well.

Not really interested in writing it myself, utoipa-gen is already able to read our license.

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

No branches or pull requests

2 participants