Validate properties and well known annotations in your Backstage catalog-info.yaml files.

Related tags

Validation backstage
Overview

Backstage entity validator

This package can be used as a GitHub action or a standalone node.js module

GitHub action

Inputs

path

Optional Path to the catalog-info.yaml file to validate. Defaults to catalog-info.yaml at the root of the repository.

Outputs

None. Prints out the validated YAML on success. Prints out errors on invalid YAML

Example usage

- uses:  RoadieHQ/[email protected]
  with:
    path: 'catalog-info-1.yaml'

CircleCI Orb

Inputs

path

Optional Path to the catalog-info.yaml file to validate. Defaults to catalog-info.yaml at the root of the repository.

Outputs

None. Prints out the validated YAML on success. Prints out errors on invalid YAML

Example config

description: >
  Sample catalog-info.yaml validation
usage:
  version: 2.1
  orbs:
    entity-validator: "roadiehq/[email protected]"
  workflows:
    use-entity-validator:
      jobs:
        - entity-validator/validate:
            path: catalog-info.yaml

Running with NPM from the repository

Install dependencies

npm install

Run

Via NPM

npm run validate <path-to-file-to-be-validated.yaml>

As an executable

bin/bev <path-to-file-to-be-validated.yaml>

Running with NPM as a globally installed package

Install this package

npm install @roadiehq/backstage-entity-validator -g

Run

validate-entity <path-to-file-to-be-validated.yaml>

Comments
  • No such file or directory error during CI build

    No such file or directory error during CI build

    Version:

    Version 0.3.8

    What happened:

    We are trying to use the entity validator in an Azure DevOps build and are hitting this error:

    /usr/bin/env: 'node\r': No such file or directory

    The call we are making is: validate-entity 'catalog/**/*.yaml' -q

    We store all our catalog entities as subfolders under catalog. This works fine on a local machine but fails as soon as it runs in the CI.

    Expected behavior:

    It should validate the entities without error.

    Additional Information:

    I'm honestly just looking for some advice as to what we might be doing wrong. Thanks for making this tool!

    bug 
    opened by awanlin 6
  • Auto-discover metadata files

    Auto-discover metadata files

    Describe Request:

    Instead of requiring users to manually specify the list of Backstage YAML files, we should check all YAML files for apiVersion: backstage.io/v1alpha1 and syntax check them if they have changed.

    This would make it easier to automatically lint Backstage metadata files when running the validator as a hosted check solution.

    opened by dtuite 6
  • Possible unnecessary entry in schema

    Possible unnecessary entry in schema

    This is new to me, so it is possible that I have misunderstood something, but I believe that this line should not be here: https://github.com/RoadieHQ/backstage-entity-validator/blob/68841ee4a3cbb89ca54c58300ab55dc2807fd275/src/schemas/annotations.schema.json#L16

    I've been seeing this error when I run this validator:

    strict mode: missing type "array" for keyword "uniqueItems" at "Entity metadata annotations#/properties/metadata/properties/annotations" (strictTypes)
    

    Based on my read of the json schema spec, uniqueItems should only be present for array types, not objects - relevant doc

    bug help wanted 
    opened by davidgiesberg 6
  • [Question] Entity validator source

    [Question] Entity validator source

    Hi there,

    I was having a look at the entity validator and I notice that it points to a library hosted on NPM here: https://www.npmjs.com/package/@roadiehq/roadie-backstage-entity-validator

    The actual source code doesn't seem to be available from what I can tell though unless I'm missing something?

    I can understand that RoadieHQ may want to keep it closed source as it's useful for their business but just wanted to confirm that I haven't overlooked another repo 🙂

    Thanks!

    opened by marcus-crane 3
  • Locations fail without `spec` attribute which is inconsistent with docs

    Locations fail without `spec` attribute which is inconsistent with docs

    Version:

    0.3.7

    What happened:

    validator fails with:

    Your catalog file(s) is/are not valid:
    
    There was an error verifying entity-templates/catalog-info-2.yml:
    TypeError: <root> should have required property 'spec' - missingProperty: spec
    

    Expected behavior:

    the validator should succeed (no errors should arise). This should happen because of these backstage docs which show spec as optional

    Additional Information:

    here is a sample Location (catalog-info.yaml)

    apiVersion: backstage.io/v1alpha1
    kind: Location
    metadata:
      name: todo-example-project
    

    a fix was to add a dummy spec:

    apiVersion: backstage.io/v1alpha1
    kind: Location
    metadata:
      name: todo-example-project
    spec:
      type: dummy
    
    bug 
    opened by Counterfly 3
  • Add CLI with support for validating multiple files

    Add CLI with support for validating multiple files

    Problem

    The tool does not support validating multiple files at once.

    Solution

    Introduce a CLI that makes it possible to validate several files at once.

    Notes

    We first tried to wrap the invocation of this tool in a shell script, calling it once per file we needed to validate. With ~400 files it took ~6m30s to complete which felt too long.

    We speculated that the bulk of the time being spent during a single execution was in the Ajv schema-validation compile phase. We hacked up a script to validate our suspicion and indeed found it to be true. We were able to validate ~400 files in ~6s; with the schema-validation compile happening once (It looks like Ajv caches compilation; calling it a second time is pretty fast).


    The choice to use minimist was based on introducing the least number of dependencies.


    There are two ways to provide files to validate:

    1. via CLI arguments
    2. via STDIN

    We chose not to include a file-finder/globber as we felt that role was best left to other tools. e.g. via shell globbing validate-entity catalog/**/*.yaml, or piped input find ./catalog/ -name '*.yaml' -or -name '*.yml' | validate-entity -i


    Validating several files at once produces a lot of output. To that end, a quiet option was introduced to control the verbosity of existing logging statements.


    Care was taken to not introduce changes to the existing CLI interface which expects a single file to validate.


    CLI usage:

    ❯ node src/index.js -h
    Usage: validate-entity [OPTION] [FILE]
    
    Validates Backstage entity definition files.  Files may be specified as
    arguments or via STDIN, one per line.
    
    OPTION:
    -h  display help
    -q  minimal output while validating entities
    -i  validate files provided over standard input
    
    opened by joncfoo 3
  • Relax source-location annotation validation

    Relax source-location annotation validation

    Problem

    Some links that we use do not have a trailing slash at the end. Adding the trailing slash to these URLs results in a 404.

    Solution

    Remove the required trailing slash at the end of the source-location validator for non-directory locations. This allows us to use locations like url:http://some/where/else.

    opened by joncfoo 3
  • run dos2unix on src/index.js

    run dos2unix on src/index.js

    Should fix https://github.com/RoadieHQ/backstage-entity-validator/issues/35 When I ran the file command on src/index.js I got the following error:

    backstage-entity-validator/src/index.js: C source, ASCII text, with CRLF line terminators
    

    I ran dos2unix tool on the index.js file and on a build it regenerated the changed files.

    Use dist/index.js as entrypoint for the program. It cannot be overwritten in the publishConfig

    opened by kissmikijr 2
  • Follow links in Location files

    Follow links in Location files

    Describe Request:

    A good way to represent a Monorepo in Backstage is to have a Location file at the root of the repo and include links in it to point to other files in the subdirectories where the metadata actually lives.

    The validator should follow the links in these Location files to discover and validate the metadata in the subdirectories.

    enhancement 
    opened by dtuite 2
  • Add support for validating multiple files in GitHub Actions

    Add support for validating multiple files in GitHub Actions

    As outlined in #15, it is not possible to validate multiple files using the GitHub Action. This Pull Requests add support for the following scenarios

    Validate multiple files separated by comma

    Actions do not support arrays, only string values see. This is a workaround to support multiple files passed in from a single input.

    - uses:  RoadieHQ/[email protected]
      with:
        path: 'catalog-info-1.yaml,catalog-info-2.yaml,catalog-info-3.yaml'
    

    Validate multiple files using a glob

    Using a glob allows you to define a pattern and expand the input. In the example below, all files matching this pattern will be returns.

    - uses:  RoadieHQ/[email protected]
      with:
        path: 'catalog-info-*.yaml,services/**/*/catalog-info.yaml'
    

    General globbing support

    Even the terminal expands glob patterns, in certain situations this does not work e.g. when passing a list of files using STDIN. With this change globs are supported in scenarios.

    opened by stefanbuck 2
  • GitHub Action: Allow multiple files as input

    GitHub Action: Allow multiple files as input

    Hi, thank you so much for creating this validator. I've noticed that the input (in a Github Action context) can be only a single path. In our monorepo context this doesn't scale very well. Ideally I would like to be able to define a glob or pass in a list of files like

    - uses: RoadieHQ/backstage-entity-validator@@0.3.0
      with:
        path: './a/service-a.yaml ./b/service-b.yaml ./c/service-c.yaml'
    

    or as a glob

    - uses: RoadieHQ/backstage-entity-validator@@0.3.0
      with:
        path: './*/service-*.yaml'
    

    Would you accept such a contribution?

    opened by stefanbuck 2
  • Bump minimatch from 3.0.4 to 3.1.2

    Bump minimatch from 3.0.4 to 3.1.2

    Bumps minimatch from 3.0.4 to 3.1.2.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Update action to use Node 16

    Update action to use Node 16

    Describe Request:

    Github has announced they will be deprecation of Node 12 in actions and recommending upgrading to use Node 16. Using this action currently results in the following warning.

    Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16

    Supporting Documentation Links:

    https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/

    opened by jsatt 2
  • Bump @actions/core from 1.2.7 to 1.9.1

    Bump @actions/core from 1.2.7 to 1.9.1

    Bumps @actions/core from 1.2.7 to 1.9.1.

    Changelog

    Sourced from @​actions/core's changelog.

    1.9.1

    • Randomize delimiter when calling core.exportVariable

    1.9.0

    • Added toPosixPath, toWin32Path and toPlatformPath utilities #1102

    1.8.2

    • Update to v2.0.1 of @actions/http-client #1087

    1.8.1

    • Update to v2.0.0 of @actions/http-client

    1.8.0

    1.7.0

    1.6.0

    1.5.0

    1.4.0

    1.3.0

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Orb usage examples are wrong - recommend adding a job to the orb to make them right

    Orb usage examples are wrong - recommend adding a job to the orb to make them right

    Version:

    0.4.2

    What happened:

    The usage examples for the Circle Orb suggest a job is provided by the orb, when it is in fact a command. This means the examples don't actually work.

    Instead of doing this:

    description: >
      Sample catalog-info.yaml validation
    usage:
      version: 2.1
      orbs:
        entity-validator: "roadiehq/[email protected]"
      workflows:
        use-entity-validator:
          jobs:
            - entity-validator/validate:
                path: catalog-info.yaml
    

    You actually need something like this:

    description: >
      Sample catalog-info.yaml validation
    usage:
      version: 2.1
      orbs:
        entity-validator: "roadiehq/[email protected]"
       
    jobs:
      validate:
        docker:
          - image: cimg/node:lts
        steps:
          - checkout
          - entity-validator/validate:
              path: catalog-info.yaml
          
    workflows:
      use-entity-validator:
        jobs:
          - validate
    

    Expected behavior:

    Whilst this could just be a documentation update, ideally the orb would provide both a job and command. The job would minimise the amount of config required to get something up and running quickly, and also mean the examples would work

    Additional Information:

    I'm happy to make a PR with the changes to add a job, but I'm a bit nervous because the build doesn't actually test the orb is working (https://github.com/RoadieHQ/backstage-entity-validator/issues/46)

    bug 
    opened by gavinclarkeuk 2
  • Circle CI Orb build not executing integration tests

    Circle CI Orb build not executing integration tests

    What happened:

    I was looking to make some enhancements to the Circle CI Orb, to make it a little easier to use however on looking at the build I realise that the Orb tests defined in the integration-test-1 job are never invoked

    Expected behavior:

    The CircleCI build should run the integration tests to verify the Orb works before publishing.

    Additional Information:

    Due to limitations in Orb testing it might not be possible to test out unhappy paths, but it should be straightforward to run through the happy path examples.

    Looks like this orb is based on a slightly older orb template, but you can see how the tests should be invoked by looking at the template here

    bug 
    opened by gavinclarkeuk 2
Releases(v0.3.2)
  • v0.3.1(Sep 8, 2021)

    Validate multiple files separated by comma

    Actions do not support arrays, only string values see. This is a workaround to support multiple files passed in from a single input.

    - uses:  RoadieHQ/[email protected]
      with:
        path: 'catalog-info-1.yaml,catalog-info-2.yaml,catalog-info-3.yaml'
    

    Validate multiple files using a glob

    Using a glob allows you to define a pattern and expand the input. In the example below, all files matching this pattern will be returns.

    - uses:  RoadieHQ/[email protected]
      with:
        path: 'catalog-info-*.yaml,services/**/*/catalog-info.yaml'
    

    General globbing support

    Even the terminal expands glob patterns, in certain situations this does not work e.g. when passing a list of files using STDIN. With this change globs are supported in scenarios.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.7(Jul 20, 2021)

    Remove the required trailing slash at the end of the source-location validator for non-directory locations. This allows us to use locations like url:http://some/where/else.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.6(May 28, 2021)

    • Adding a dummy text replacement to cater for cases where a string value is referenced via $text magic word
      • These would be replaced before validation in Backstage instances which is not possibly to do with a standalone validator
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(May 18, 2021)

    Runs through validators from @backstage/catalog-model. Checks well-known annotations and few extra annotations so that they have a correct format.

    Source code(tar.gz)
    Source code(zip)
Owner
Roadie
Backstage for growing engineering teams.
Roadie
The best @jquery plugin to validate form fields. Designed to use with Bootstrap + Zurb Foundation + Pure + SemanticUI + UIKit + Your own frameworks.

FormValidation - Download http://formvalidation.io - The best jQuery plugin to validate form fields, designed to use with: Bootstrap Foundation Pure S

FormValidation 2.8k Mar 29, 2021
[DISCONTINUED] jQuery plugin that makes it easy to validate user input while keeping your HTML markup clean from javascript code.

jQuery Form Validator [DISCONTINUED] Validation framework that let's you configure, rather than code, your validation logic. I started writing this pl

Victor Jonsson 976 Dec 30, 2022
A simple and composable way to validate data in JavaScript (and TypeScript).

A simple and composable way to validate data in JavaScript (and TypeScript). Usage • Why? • Principles • Demo • Examples • Documentation Superstruct m

Ian Storm Taylor 6.3k Jan 9, 2023
jQuery library to validate html forms. compatible with bootstrap v4 and bootstrap v3

jQuery form validation jQuery form validation is a library that helps you to validate your HTML form, it's completable with both Bootstrap 3 and Boots

Bassam Nabriss 33 Jun 10, 2021
Validate for XML schema and returns all the possible failures

detailed-xml-validator Validate for XML schema and returns all the possible failures Sample Rules file <?xml version = "1.0"?> <students nillable="fa

Natural Intelligence 11 Dec 20, 2022
This Login Form made using React hooks , React Js , Css, Json. This form have 3 inputs, it also validate those inputs & it also having length limitations.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Yogesh Sharma 0 Jan 3, 2022
Validate graphql operations against a schema

@graphql-validate With the power of GraphQL-Tools and GraphQL-JS, we are able to provide a smooth experience for validation your GraphQL operations du

Saihajpreet Singh 13 Dec 23, 2022
A library for validate a string using regular expressions.

Fogex Form Regex Quickly and easily check if the content is valid. Installation npm install fogex or yarn add fogex Usage import fogex from 'fogex';

null 5 May 5, 2022
A simple library to validate Mexican CURPs (Personal ID)

Validate CURP A simple and lightweight library to validate Mexican CURPs (Personal ID). Install NodeJS Use NPM: $ npm install --save validate-curp Or

Manuel de la Torre 15 Nov 24, 2022
Codestamp - Stamp and verify your files and contents

A language-agnostic tool for signing and verifying your (codegen'd) files and contents.

Keyan Zhang 4 Jan 26, 2022
Simple translation for your javascripts, yummy with your favorite templates engine like EJS.

jsperanto Simple translation for your javascripts, yummy with your favorite templates engine like EJS. Pluralization, interpolation & "nested lookup"

Jean-Philippe Joyal 62 Oct 21, 2021
Themis is a validation and processing library that helps you always make sure your data is correct.

Dataffy Themis - The advanced validation library Themis is a validation and processing library that helps you always make sure your data is correct. ·

Dataffy 14 Oct 27, 2022
DiscordEmailVerifier - Quickly verify emails on your tokens for completely free using mail.tm's api.

DiscordEmailVerifier Quickly verify emails on your tokens for completely free using mail.tm's api. /* ❗ No, this code doesn't verify the email for you

eric 3 Jun 7, 2022
Copypaster Has your project structure gotten so complex that to add a new feature you need to copy

Copypaster Has your project structure gotten so complex that to add a new feature you need to copy, paste and rename tens or hundreds of files each ti

null 2 Nov 4, 2022
The Vue form assembly tool that won't break your heart 💔

Loveform The Vue form assembly tool that won't break your heart ?? Loveform is a tool that helps you build validated forms in Vue 3 without the need t

Daniel Leal 16 Jun 10, 2022
FieldVal - multipurpose validation library. Supports both sync and async validation.

FieldVal-JS The FieldVal-JS library allows you to easily validate data and provide readable and structured error reports. Documentation and Examples D

null 137 Sep 24, 2022