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

schema with refs #18

Open
jhoogeboom opened this issue Aug 29, 2018 · 1 comment
Open

schema with refs #18

jhoogeboom opened this issue Aug 29, 2018 · 1 comment

Comments

@jhoogeboom
Copy link

jhoogeboom commented Aug 29, 2018

trying to process a schema with refs, based on your documentation I process the schema first to dereference the (internal) refs.

<script>
import jsonSchema from '@/components/Schema/europass-json-schema-v3.3.0.json'
import example from '@/components/Schema/europass-cv-example-v3.3.0.json'
import parser from 'json-schema-ref-parser';

export default {
  schema: [
    async function loadSchemaOnCreate() {
      // functions must return a promise or a schema synchronously
      return await parser.dereference(jsonSchema)
    }],
  name: 'app',
  data () {
    return {
      schema: example
    }
  }
 }
</script>

Something's not going well though
screen shot 2018-08-29 at 20 41 23

You can find the schema and example if you want to have a look: https://interop.europass.cedefop.europa.eu/data-model/json-resources/

@jhoogeboom
Copy link
Author

jhoogeboom commented Aug 30, 2018

if anyone runs into something similar, this seemed to work better for dereferencing:
https://www.npmjs.com/package/json-schema-deref-local

and it seems the objects are not initiated by default, this works well to generate it:
https://www.npmjs.com/package/json-schema-defaults

export default {
  schema: deref(jsonSchema),
  name: 'app',
  data () {
    return {
      schema: defaults(this.$options.schema)
      }
  }
}
</script>

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

No branches or pull requests

1 participant