GithubHelp home page GithubHelp logo

l0vecraft / shex-codegen Goto Github PK

View Code? Open in Web Editor NEW
17.0 4.0 4.0 1.86 MB

Generate typescript code from shex

License: MIT License

TypeScript 97.09% JavaScript 2.91%
shex typescript shape-expression

shex-codegen's People

Contributors

dependabot[bot] avatar l0vecraft avatar renovate-bot avatar thisismissem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

shex-codegen's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @types/js-yaml to v4.0.6
  • fix(deps): update dependency chalk to v4.1.2
  • fix(deps): update dependency nodemon to v2.0.22
  • chore(deps): update babel monorepo (@babel/preset-env, @babel/preset-typescript)
  • chore(deps): update dependency @types/prettier to v2.7.3
  • chore(deps): update dependency eslint-plugin-import to v2.28.1
  • chore(deps): update dependency shex-methods to v0.2.12
  • chore(deps): update dependency typescript to v4.9.5
  • fix(deps): update dependency camelcase to v6.3.0
  • fix(deps): update dependency fs-extra to v10.1.0
  • fix(deps): update dependency js-yaml to v4.1.0
  • fix(deps): update dependency prettier to v2.8.8
  • chore(deps): update actions/cache action to v3
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v3
  • chore(deps): update dependency @types/node to v18
  • chore(deps): update dependency concurrently to v8
  • chore(deps): update dependency eslint-plugin-prettier to v5
  • chore(deps): update dependency husky to v8
  • chore(deps): update dependency lint-staged to v14
  • chore(deps): update dependency rimraf to v5
  • chore(deps): update dependency typescript to v5
  • fix(deps): update dependency camelcase to v8
  • fix(deps): update dependency fs-extra to v11 (fs-extra, @types/fs-extra)
  • fix(deps): update dependency nodemon to v3
  • fix(deps): update dependency prettier to v3
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/jest.yml
  • actions/checkout v2
  • actions/setup-node v2
  • actions/cache v2
npm
package.json
  • @shexjs/visitor ^1.0.0-alpha.25
  • @shexjs/parser ^1.0.0-alpha.25
  • @types/shexj ^2.1.0
  • camelcase ^6.2.0
  • chalk ^4.1.0
  • findit ^2.0.0
  • fs-extra ^10.0.0
  • js-yaml ^4.0.0
  • nodemon ^2.0.7
  • own-namespace ^0.4.5
  • prettier ^2.2.1
  • @babel/preset-env 7.16.7
  • @babel/preset-typescript 7.16.7
  • @types/fs-extra 9.0.13
  • @types/jest 26.0.24
  • @types/js-yaml 4.0.5
  • @types/node 14.18.4
  • @types/nodemon 1.19.1
  • @types/prettier 2.4.2
  • @typescript-eslint/eslint-plugin 4.33.0
  • @typescript-eslint/parser 4.33.0
  • concurrently 6.5.1
  • eslint 7.32.0
  • eslint-plugin-import 2.25.4
  • eslint-plugin-prettier 3.4.1
  • husky 6.0.0
  • jest 26.6.3
  • lint-staged 11.2.6
  • rdflib 2.2.15
  • rimraf 3.0.2
  • shex-methods 0.1.21
  • ts-node 9.1.1
  • typescript 4.5.4

  • Check this box to trigger a request for Renovate to run again on this repository

Value sets not properly supported

In Shex Node Constraints specification, a set of expected values is expressed as follows:

PREFIX my: <https://my.example.com/#>
PREFIX ex: <https://my.example.com/ex#>

my:IssueShape {
  ex:state [ ex:unassigned ex:assigned ]
}

โ†’ Given the above shex, it is expected that the code-gen produces a field with a singleton attribute with an accepted range of two values.

This is currently not the case.

Actual

For the above shex, the code-gen generates the following:

import { NamedNode, Literal } from "rdflib";

import { Shape } from "shex-methods";

export type myExampleCom = {
  id: string; // the url of a node of this shape
  state: (StateType.Unassigned | StateType.Assigned)[];
};

export type myExampleComCreateArgs = {
  id?: string | NamedNode; // the url to match or create the node with e.g. 'https://example.com#this', 'https://example.com/profile/card#me'
  state: (StateType.Unassigned | StateType.Assigned)[];
};

export type myExampleComUpdateArgs = Partial<myExampleComCreateArgs>;

export enum StateType {
  Unassigned = "https://my.example.com/ex#unassigned",
  Assigned = "https://my.example.com/ex#assigned",
}

export enum myExampleComContext {
  name = "state",
  value = "ex:state",
}

export const exampleShex = `
PREFIX my: <https://my.example.com/#>
PREFIX ex: <https://my.example.com/ex#>

my:IssueShape {
  ex:state [ex:unassigned ex:assigned]
}

`;

export const myExampleCom = new Shape<myExampleCom, myExampleComCreateArgs>({
  id: "https://my.example.com/#IssueShape",
  shape: exampleShex,
  context: myExampleComContext,
});

โ†’We can see that the value generated for state is not a singleton field, but an array of values from the given range.
state: (StateType.Unassigned | StateType.Assigned)[];

Expected

The expect shape should have been this.

export type myExampleCom = {
  id: string;
  state: StateType.Unassigned | StateType.Assigned;
};

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Configuration option packageRules should be a list (Array)

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.