GithubHelp home page GithubHelp logo

Comments (4)

eddyystop avatar eddyystop commented on July 2, 2024

How are you running that fragment to cause the error?

Could you provide the full path of the module which is throwing? Its not part of the generator, nor of ajv, the module validateSchema uses. So I have no idea which dependency is throwing.

from generator-feathers-plus.

samburgers avatar samburgers commented on July 2, 2024

Thanks for the reply, here are the steps to reproduce

Generate App

feathers-plus generate app

? Project name fpcli
? Description Project fpcli
? What folder should the source files live in? src
? Which package manager are you using
  (has to be installed globally)? Yarn
? What type of API are you making?
 REST, Realtime via Socket.io
? Data mutating tests and seeding may run when NODE_ENV is one of (optional) test
? Seed data records on startup when command line includes --seed? Yes

Generate Service

feathers-plus generate service

? What is the name of the service? posts
? What would you call one row in the posts database? post
? What kind of service is it? Mongoose
? Place service code in which nested folder, e.g. `v1/blog`? (optional) 
? Which path should the service be registered on? /posts
? Should this be served by GraphQL? Yes

Add Object with properties to schema:

/src/services/posts/posts.schema.js

properties: {
  // !code: schema_properties

  address: {
      type: 'object',
      additionalProperties: { type: 'string' },
      maxProperties: 6,
      required: ['street', 'postcode', 'city', 'country']
    },
  // !end
}

Rerun service generate:

feathers-plus generate service

? What is the name of the service? posts
? What would you call one row in the posts database? post
? What kind of service is it? Mongoose
? Place service code in which nested folder, e.g. `v1/blog`? (optional)
? Which path should the service be registered on? /posts
? Should this be served by GraphQL? Yes
events.js:183
      throw er; // Unhandled 'error' event
      ^

TypeError: subTypes.map is not a function
    at Object.keys.forEach.name (/Users/me/.config/yarn/global/node_modules/@feathers-plus/generator-feathers-plus/lib/service-specs-to-typescript.js:24:32)
    at Array.forEach (<anonymous>)
    at serviceSpecsToTypescript (/Users/me/.config/yarn/global/node_modules/@feathers-plus/generator-feathers-plus/lib/service-specs-to-typescript.js:16:27)
    at service (/Users/me/.config/yarn/global/node_modules/@feathers-plus/generator-feathers-plus/generators/writing/index.js:583:7)
    at generatorWriting (/Users/me/.config/yarn/global/node_modules/@feathers-plus/generator-feathers-plus/generators/writing/index.js:253:7)
    at ServiceGenerator.writing (/Users/me/.config/yarn/global/node_modules/@feathers-plus/generator-feathers-plus/generators/service/index.js:246:5)
    at Object.<anonymous> (/Users/me/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:424:27)
    at /Users/me/.config/yarn/global/node_modules/run-async/index.js:25:25
    at new Promise (<anonymous>)
    at /Users/me/.config/yarn/global/node_modules/run-async/index.js:24:19
    at self.env.runLoop.add.completed (/Users/me/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:425:13)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)

from generator-feathers-plus.

eddyystop avatar eddyystop commented on July 2, 2024

I misunderstood you when you mentioned "json-schema validations". I understood that as you trying to validate record contents using some of the exports from src/services/name/name.validate.?s.

The name.schema.?s expects type: 'object' to contain a poperties property which contains at least one field.

So, from the example, instead of

    "address": {
      "type": "object",
      "additionalProperties": { "type": "string" },
      "maxProperties": 6,
      "required": ["street", "postcode", "city", "country"]
    },

rather like the following

    "personal": {
      "type": "object",
      "properties": {
        "DOB": { "type": "string", "format": "date" },
        "age": { "type": "integer", "minimum": 13 },
        "gender": { "enum": ["female", "male"] }
      }
      "required": ["DOB", "age"],
      "additionalProperties": false
    },
``

from generator-feathers-plus.

eddyystop avatar eddyystop commented on July 2, 2024

I added an issue to support the notation used in address #64

from generator-feathers-plus.

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.