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

Use an external json schema for botconfig #1894

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

isuruf
Copy link
Member

@isuruf isuruf commented Mar 26, 2024

Need to use orjson because pydantic.Url is not json dumpable
@isuruf isuruf requested a review from a team as a code owner March 26, 2024 22:56
@isuruf isuruf marked this pull request as draft March 26, 2024 23:02
class Config:
json_schema_extra = {
"$ref": Url(
"https://gist.githubusercontent.com/isuruf/7fbc5a6d53e6a3f5450b90a12c1ace5a/raw/ddb6054c8683ac302a567bd8b42e792a8d4bda30/conda-forge-bot-config.json"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME: change this

Copy link
Member

@beckermr beckermr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. I'm fine producing the schema right in this repo and not having to use a gist. I'm guessing we'll have to merge once before that works?

Edit: I thought this was cf-scripts. Now this PR makes more sense to me. 🤦‍♂️

@isuruf
Copy link
Member Author

isuruf commented Mar 26, 2024

We'll move the Pydantic model to regro/cf-scripts and dump the schema to that repo too. Then we can use the URL for that file here.

@ytausch
Copy link
Contributor

ytausch commented Mar 27, 2024

Some thoughts about this:

  • Do we really need Url and orjson here? I think it should be enough to reference the other schema as a string, removing the additional serialization overhead.
  • I suggest not to include the other schema as JSON schema but rather to properly import it as a Pydantic model. Otherwise, it will not be possible to use the Pydantic model to access all fields, as explained here. I don't like seeing Pydantic to be downgraded to a JSON schema generation engine, as it's much more powerful if used correctly.

@jaimergp jaimergp linked an issue Apr 29, 2024 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

Move BotConfig to regro/cf-scripts and use it in conda-smithy
3 participants