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

download attribute in project schema #713

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

yashgoyal0110
Copy link
Contributor

fixes: #697

@yashgoyal0110 yashgoyal0110 force-pushed the fix/schema-download-attribute branch from 4ed7867 to d38c1dc Compare February 2, 2025 17:06
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

Could you add more test cases based on the field requirements?

@yashgoyal0110
Copy link
Contributor Author

Could you add more test cases based on the field requirements?

I tried but how can I apply for array items, as there is no enum for it

@arkid15r
Copy link
Collaborator

arkid15r commented Feb 2, 2025

Could you add more test cases based on the field requirements?

I tried but how can I apply for array items, as there is no enum for it

I'd like to have at least the following test cases:

  • empty array
  • non URI value
  • non unique values

@yashgoyal0110
Copy link
Contributor Author

Could you add more test cases based on the field requirements?

I tried but how can I apply for array items, as there is no enum for it

I'd like to have at least the following test cases:

  • empty array
  • non URI value
  • non unique values

okay

@yashgoyal0110
Copy link
Contributor Author

Could you add more test cases based on the field requirements?

I tried but how can I apply for array items, as there is no enum for it

I'd like to have at least the following test cases:

  • empty array
  • non URI value
  • non unique values

okay

all tests passed

Screenshot 2025-02-03 at 2 17 48 AM

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

Please use alphabetical order for new attributes everywhere.

def validate_data(schema, data):
# Perform URL validation before schema validation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think yes, If we detect invalid URLs in the downloads list before calling validate(), we can skip the full schema validation and return an error immediately.
This prevents unnecessary processing and speeds up validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In this particular case I'd prefer code readability vs validation performance. Out tests/validation speed is not a goal here, at least now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but currently there's no existing validation for URIs, then where we gonna add validation for it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should extend the validator to cover URIs too then. Refer to the docs on how to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add downloads attribute to project schema
2 participants