Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Include Schema Documentation #43

Closed
trieloff opened this issue Mar 24, 2019 · 5 comments
Closed

Include Schema Documentation #43

trieloff opened this issue Mar 24, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@trieloff
Copy link
Contributor

The schema documentation right now links to the raw files on GitHub instead of being served through Helix, because the foo.schema.html is interpreted as a call to schema_html.htl, i.e. schema is the selector.

I've been thinking about approaches to solving this including:

  1. getting jsonschema2md to generate files that don't have more than one dot in the file name
  2. allowing a configuration in Helix to determine which names are valid selector names
  3. allowing Helix to do fall-backs in case a selector function can't be found
  4. finding a project-level workaround

As I think configurations (2) and fallbacks (3) complicate things, the most promising options seem to be (1) or (4). One way to implement (4):

  • create a schema_html.htl and schema_html.pre.js
  • in pre.js add a before.fetch extension point that replaces foo.md with foo.schema.md
  • go on as before
@trieloff trieloff added the enhancement New feature or request label Mar 24, 2019
@kptdobe
Copy link
Contributor

kptdobe commented Mar 25, 2019

+1 for your implementation proposal of 4 for now.

Whatever we do, the resolution will have to somehow end up into the VCL (determine if template selector or content file name).

When we hlx publish can't we just build the list of known template selectors and add it to the dynamic.vcl. When parsing the request, if the selector is not in that list, than consider as part of content file name.

@trieloff
Copy link
Contributor Author

DO you have a preference for 2 or 3?

2 could look like this:

strains:
  - name: default
    selectors:
      - nav
      - video

@kptdobe
Copy link
Contributor

kptdobe commented Mar 25, 2019

oh sorry if this was not clear, I think it should be automatic, i.e. no extra config! You can compute this list based on the list of templates in the project folder and fallback to content if the selector is not part of this list.
Thus I assume this is 3 (but without a lookup, list is pre-computed on publish).

@trieloff
Copy link
Contributor Author

Ah, inspecting the available templates is a good idea. We just have to find a way to carry that information forward.

@kptdobe
Copy link
Contributor

kptdobe commented Mar 25, 2019

That was my initial proposal: generate a list in dynamic.vcl (or a dedicated file for that). If selector in the list, use as template, otherwise append to content path. Something like that ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants