loopbackio / loopbackio/loopback-next

Support GeoPoint type

Open
#1,981 42 comments 9 reactions 0 assignees View on GitHub
feature feature parity help wanted major needs grooming
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

# Description/Steps to reproduce
I'm attempting to start my project by using `npm start` and get the following output:
```
> project-api@1.0.0 prestart /Users/joris/Documents/Personal/Projects/project/project-api
> npm run build

> project-api@1.0.0 build /Users/joris/Documents/Personal/Projects/project/project-api
> lb-tsc es2017 --outDir dist

> project-api@1.0.0 start /Users/joris/Documents/Personal/Projects/project/project-api
> node .

Cannot start the application. Error: Unsupported type: geopoint
at stringTypeToWrapper (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/repository-json-schema/dist/src/build-schema.js:68:19)
at metaToJsonProperty (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/repository-json-schema/dist/src/build-schema.js:101:25)
at modelToJsonSchema (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/repository-json-schema/dist/src/build-schema.js:151:32)
at Object.getJsonSchema (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/repository-json-schema/dist/src/build-schema.js:22:27)
at generateOpenAPISchema (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/openapi-v3/dist/src/controller-spec.js:181:49)
at resolveControllerSpec (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/openapi-v3/dist/src/controller-spec.js:128:17)
at Object.getControllerSpec (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/openapi-v3/dist/src/controller-spec.js:205:16)
at RestServer._setupHandlerIfNeeded (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/rest/dist/src/rest.server.js:195:42)
at RestServer.start (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/rest/dist/src/rest.server.js:498:14)
at _forEachServer.s (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/core/dist/src/application.js:123:42)
at Promise.all.bindings.map (/Users/joris/Documents/Personal/Projects/project/project-api/node_modules/@loopback/core/dist/src/application.js:145:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project-api@1.0.0 start: `node .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project-api@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/joris/.npm/_logs/2018-11-05T15_06_38_766Z-debug.log
```

In one of my models, I have a property of type 'geopoint':
```
@property({
type: 'geopoint',
required: true,
})
location: string;
```

Upon closer inspection, no `case` is defined for the `'geopoint'` type in the switch statement in `@loopback/repository-json-schema/dist/src/build-schema.js`.

# Expected result

For the Loopback 4 project to start.

# Additional information

- `node -e 'console.log(process.platform, process.arch, process.versions.node)'` shows `darwin x64 10.12.0`
- `npm ls --prod --depth 0 | grep loopback` shows no output

Contributor guide

Open the contributing guide

Research direction

Start with the switch in @loopback/repository-json-schema/dist/src/build-schema.js that reports “Unsupported type: geopoint,” then trace how the schema is generated through @loopback/openapi-v3. Run the reported npm start scenario with a model using a geopoint property; done means the application starts without that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.