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

Add sorting and validation on Type tableSchema #263

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

ylyangtw
Copy link
Contributor

@ylyangtw ylyangtw commented Jan 19, 2024

This PR

  • Added sorting ability to columns (removed after team discussion)
  • Added POST type validation on columns

For testing, there are 2 endpoints need to look at:

  • GET /semantics/api/types?detail=True
    • Within each tableSchema, columns should be sorted by name in ascending order
    • The following is an expected example
"tableSchema": {
            "columns": [
                {
                    "dc:description": "Probability of complete damage",
                    "datatype": "xsd:double",
                    "name": "complete",
                    "titles": "complete",
                    "qudt:unit": "qudt:CountingUnit",
                    "required": "true"
                },
                {
                    "dc:description": "Expected damage state",
                    "datatype": "xsd:string",
                    "name": "expectval",
                    "titles": "expectval",
                    "qudt:unit": "unit:UNITLESS",
                    "required": "true"
                }
            ]}
  • POST /semantics/api/types
    • Please try uploading the following doc, and change the column titles ("dc:description", "datatype", "name", "titles", "qudt:unit", "required"). If any of the column titles is missing, the service is expected to throw an exception.
    • I added this validation because there are some invalid formats in semanticsdb, hence it might be good to add some constraints to avoid posting bad formats to the database.
    • Remember to delete the type after testing if you are testing against dev/prod.
{"@context":
["http://www.w3.org/ns/csvw",
{"@language":"en","gml":"http://www.opengis.net/gml/","iwfs":"http://www.ionicsoft.com/wfs/","xlink":"http://www.w3.org/1999/xlink/","xsd":"http://www.w3.org/2001/XMLSchema/","qudt":"http://qudt.org/2.0/schema/qudt/","unit":"http://qudt.org/vocab/unit/","openvocab":"http://vocab.org/open/"}],
"dc:license":{"@id":"http://opendefinition.org/licenses/cc-by/"},"dc:title":"tests","dc:description":"","url":"tests","openvocab:versionnumber":"1.0",
"tableSchema":{"columns":[{"name":"","titles":"","dc:description":"","datatype":"xsd:integer","required":"true","qudt:unit":""}]}}

@ylyangtw ylyangtw linked an issue Jan 19, 2024 that may be closed by this pull request
@ylyangtw ylyangtw changed the title Added sorting and validation on columns Add sorting and validation on columns Jan 19, 2024
@ylyangtw ylyangtw changed the title Add sorting and validation on columns Add sorting and validation on Type tableSchema Jan 19, 2024
@ylyangtw ylyangtw requested a review from a team January 19, 2024 16:08
Copy link
Member

@longshuicy longshuicy left a comment

Choose a reason for hiding this comment

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

Tested against dev and works well. This improves the robustness of the semantic service good work!

@ywkim312 ywkim312 merged commit aeb0c94 into develop Jan 24, 2024
6 checks passed
@ywkim312 ywkim312 deleted the 238-sort-semantic-definition-alphabetically-1 branch January 24, 2024 22:21
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.

Sort Semantic Definition Alphabetically
3 participants