Giter Site home page Giter Site logo

Comments (5)

roadie-bot avatar roadie-bot commented on August 22, 2024

https://app.shortcut.com/larder/story/9176

from backstage-entity-validator.

daftgopher avatar daftgopher commented on August 22, 2024

Amending this slightly because I found that $text will actually pass the validator. $yaml and $json still do not seem to be supported.

from backstage-entity-validator.

kissmikijr avatar kissmikijr commented on August 22, 2024

Hey, it is confusing, however the linked docs generally talks about the addition of these processors to Backstage, and gives an example with an entity Kind: API.
But if you try the catalog does not accept anything else to the definition field only string. You can see the schema that we use to validate here: https://github.com/backstage/backstage/blob/490d663a55ad1d91850979048b0582056e45517b/packages/catalog-model/src/kinds/ApiEntityV1alpha1.ts#L37

In the case of these substitutions the preprocessor would create a json object to the definition, but the definition should be a json string. That's why it fails.

from backstage-entity-validator.

daftgopher avatar daftgopher commented on August 22, 2024

Yeah, I have a little more context on this now and I realize that the processor essentially reads and parses the contents of these $-prefixed keys as embedded strings during the catalog ingestion process. However, I've also noticed that $json and $yaml either don't work the way I expect or I'm simply using them incorrectly because I've never gotten them to properly fetch data from a remote source, e.g.

kind: API
...
spec:
  ...
  definition:
    $yaml: https:///www.example.com/path/to/an/api/definition.yaml # Does not inline into a string

This is probably why they're failing to inline correctly and the validator is treating them as objects. I've never actually seen these work when I try examples like the above. Is it correct to assume the validator is running some kind of code to inline $text as a string before the validation check is done? If so, and that code is also inlining $yaml and $json as intended, then this may be ok to close.

from backstage-entity-validator.

sikemausa avatar sikemausa commented on August 22, 2024

To piggyback off of this one, running into the same issue, but whilst trying to implement an OpenAPI spec.

spec:
  type: type
  system: system
  lifecycle: lifecycle
  owner: owner
  definition:
    $openapi: ./docs/api/oas.yaml

The above will fail validation with the following error:

Failed to validate api/catalog-info.yaml: TypeError: /spec/definition should be string - type: string

I have verified that this does indeed work within Backstage whilst pointing to an OpenAPI spec

from backstage-entity-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.