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

Replace (or remove) id field description #79

Closed
Olegt0rr opened this issue Dec 15, 2020 · 4 comments · Fixed by #82
Closed

Replace (or remove) id field description #79

Olegt0rr opened this issue Dec 15, 2020 · 4 comments · Fixed by #82
Labels
enhancement New feature or request

Comments

@Olegt0rr
Copy link
Contributor

Olegt0rr commented Dec 15, 2020

Feature request

Context

Now the id field is printed in documents with information about the used database:
MongoDB ObjectId string

I'm not sure if showing this information is a good idea.
What kind of database and what kind of identifier generation are used to store the data is not a client's business.

Solution

I suggest removing the description of the id field. This will hide unnecessary information from the user.

Alternative solutions

It will also be great if odmantic will be able to specify a custom description and parameters for id field

Additional context

It would also be great to make the example look more similar.
I.e. replace ffffffffffffffffffffffff with 5f85f36d6dfecacc68428a46

@Olegt0rr Olegt0rr added the enhancement New feature or request label Dec 15, 2020
@Olegt0rr
Copy link
Contributor Author

Olegt0rr commented Dec 18, 2020

Solution to hide this description described in #75 (comment)
But I'm still suggesting to remove current description as I wrote above

@Olegt0rr
Copy link
Contributor Author

Bad news, it's not a solution.

id: ObjectId = Field(primary_field=True, description='My ID') is overwrited by MongoDB ObjectId string description :(

@adeelsohailahmed
Copy link
Contributor

adeelsohailahmed commented Dec 18, 2020

Bad news, it's not a solution.

My solution was specific to that issue. The user wanted to use their own strings for id field for their model instead of letting ODMantic generate id itself.

@art049
Copy link
Owner

art049 commented Dec 21, 2020

Replacing the default example is totally good to me.
We can as well remove the default description.

What kind of database and what kind of identifier generation are used to store the data is not a client's business.

Unfortunately, it's a bit linked. Since we perform ObjectId validation, passing an invalid id (like a non hex string) will raise a validation error.

We can still remove the description since it's overriding everything right now though.

@art049 art049 closed this as completed in #82 Mar 3, 2021
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
None yet
Development

Successfully merging a pull request may close this issue.

3 participants