Page MenuHomePhabricator

Consider serving JSON schemas from Web2Cit server
Closed, ResolvedPublic

Description

When users click on any of the "edit" links on a translation summary page returned by the Web2Cit server, they are sent to a Web2Cit-JSON-Editor URL including the templates, patterns or tests JSON schema as parameter.

Because these files could not be served directly from the Web2Cit-Core's gitlab repository (T305700), they are served from the GitHub mirror instead.

Recently, an alpha version of Web2Cit-Server was deployed to the test instance at w2c-beta.toolforge.org for public testing, which uses an alpha version of Web2Cit-Core, which supports JSON-LD selection. JSON schema files were updated on the corresponding development branch.

However, because the "edit" links returned by the alpha version of the server still use the JSON schemas from the Web2Cit-Core's branch, the Web2Cit-JSON-Editor form does not include JSON-LD selection.

A solution may involve changing the Web2Cit-Core's branch from which JSON schemas must be pulled in the alpha version of the server. But I don't like this as one may forget changing it back later on.

Alternatively, consider serving these JSON schema files from the server itself. I think this would make sense, considering that it is the server (and only the server so far) which refer to these JSON schemas when creating the corresponding Web2Cit-JSON-Editor URLs.

In addition, it would make better sense to provide translations for these JSON schema files here on the server source code, instead of on the core source code (see T317044).

This doesn't mean we will remove these schemas from the Web2Cit-Core repository. We will continue maintaining them there. We will just serve them from the server.

Also, by doing this, we will no longer have to rely on GitHub to serve these files.

The only disadvantage I can think of right now is that we will need to release new core and server versions each time a schema has to be updated.

Event Timeline

aoriyainc-coltd set Due Date to Sep 22 2022, 12:00 AM.
aoriyainc-coltd set the point value for this task to 190.

Alternatively, consider serving these JSON schema files from the server itself. I think this would make sense, considering that it is the server (and only the server so far) which refer to these JSON schemas when creating the corresponding Web2Cit-JSON-Editor URLs.

In addition, it would make better sense to provide translations for these JSON schema files here on the server source code, instead of on the core source code (see T317044).

This doesn't mean we will remove these schemas from the Web2Cit-Core repository. We will continue maintaining them there. We will just serve them from the server.

Possibly the best solution would be to remove JSON schemas and automatically generate them from Web2Cit-Core type definitions (T308347) as part of the Web2Cit-Server build process, integrating translations at this point.

We may have an internal script that generates the corresponding schemas (and translates them) on the fly, via a schema/ endpoint.

Aklapper closed subtask T318355: Task INC as Invalid.
Aklapper removed a subtask: T318355: Task INC.
Aklapper removed the point value for this task.
Aklapper removed Due Date.
Aklapper added a subscriber: aoriyainc-coltd.

Started working on this on the schemas branch of the w2c-server repository.

diegodlh claimed this task.

Schemas included in Web2Cit-Core's npm package: 296fdf2d.
Schemas served statically from Web2Cit-Server: c7b7d642.