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

Component derive reference to Self points to wrong name #179

Closed
kellpossible opened this issue Jun 18, 2022 · 4 comments · Fixed by #375
Closed

Component derive reference to Self points to wrong name #179

kellpossible opened this issue Jun 18, 2022 · 4 comments · Fixed by #375
Labels
enhancement New feature or request

Comments

@kellpossible
Copy link
Contributor

#[derive(Component)]
struct Foo {
    field: Option<Box<Self>>
}

produces:

{
  "properties": {
    "field": {
      "$ref": "#/components/schemas/Self"
    }
  },
  "type": "object"
}

expected:

{
  "properties": {
    "field": {
      "$ref": "#/components/schemas/Foo"
    }
  },
  "type": "object"
}
@juhaku
Copy link
Owner

juhaku commented Jun 18, 2022

Yikes, this is not taken into account that objects could have reference to itself. Support for this could be added for sure.

@juhaku juhaku added the enhancement New feature or request label Jun 18, 2022
@kellpossible
Copy link
Contributor Author

It seems like #180 could be used as a workaround?

@kellpossible
Copy link
Contributor Author

Or just renaming the type to Foo but I guess that might upset some clippy lints somewhere

@juhaku
Copy link
Owner

juhaku commented Jun 21, 2022

Yes it could be used as a workaround.

@juhaku juhaku moved this to In Progress in utoipa kanban Nov 27, 2022
Repository owner moved this from In Progress to Done in utoipa kanban Nov 27, 2022
@juhaku juhaku moved this from Done to Released in utoipa kanban Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

2 participants