paperclip_core/v3/models/
reference.rs

1use super::v2;
2
3pub(crate) fn invalid_referenceor<T>(message: String) -> openapiv3::ReferenceOr<T> {
4    debug_assert!(false, "{}", message);
5    openapiv3::ReferenceOr::ref_(&message)
6}
7
8impl<T> From<v2::Reference> for openapiv3::ReferenceOr<T> {
9    #[allow(clippy::only_used_in_recursion)]
10    fn from(v2: v2::Reference) -> Self {
11        Self::from(&v2)
12    }
13}
14impl<T> From<&v2::Reference> for openapiv3::ReferenceOr<T> {
15    fn from(v2: &v2::Reference) -> Self {
16        let reference = v2.reference.replace("definitions", "components/schemas");
17        openapiv3::ReferenceOr::ref_(&reference)
18    }
19}