#125 - Tech debt, Change html parsing from the post ontology flow #115
Merged
#125 - Tech debt, Change html parsing from the post ontology flow #115
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the ontology creation flow to handle manual redirects, fetch the JSON-LD from the correct host, and update client-side proxy and UI components accordingly.
- Adds a Vite proxy rule for
.html/.jsonldontology endpoints and enhanced CORS handling. - Simplifies the success/failure logic in the AddNewOntologyDialog component.
- Rewrites
createNewOntologyto usefetchwith manual redirect handling, custom header parsing, and JSON-LD extraction.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| vite.config.js | New proxy route for ontology HTML/JSON-LD with CORS |
| src/components/SingleOrganization/AddNewOntologyDialog.jsx | Inverted result.created check and removed debug logs |
| src/api/endpoints/apiService.ts | Replaced POST helper with fetch, manual redirect logic, and JSON-LD parsing |
Comments suppressed due to low confidence (2)
src/api/endpoints/apiService.ts:165
- This new redirect-handling branch isn’t covered by existing tests; add unit tests to simulate the
x-redirect-locationheader and the JSON-LD fetch.
if (redirectLocation) {
src/components/SingleOrganization/AddNewOntologyDialog.jsx:76
- [nitpick] Success logging was removed entirely; consider logging or displaying the newly created ontology ID or location on success to aid debugging and user feedback.
if (!result.created) {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ddelpiano
approved these changes
Jul 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes create new ontology behavior, first POST new ontology. Then once we get back the redirect location of the new term, we do a GET using the endpoint and then we extract json data from there. Before we do the GET though, we need to clean up the URI as we get back 'http://uri.interlex.org/dariodippi/ontologies/uris/test_test_pbt46efr.html' , but we need 'http://uri.olympiangods.orgdariodippi/ontologies/uris/test_test_pbt46efr.jsonld'
As commented on JIRA:
Works now, and a PR was created. However, a couple of issues:
The redirect location we are getting back is not from olympiangods but from uri.interlex.org, and the jsonld is missing the ID in the response. So far our only option seems to extract from URL itself, see new ontology below for newly created: test_099_sbwulriy.jsonld: