Apos3: document the need to include 'type' in the publicApiProjection and flag a missing type as a probable missing projection property.
See original GitHub issueTo Reproduce
Step by step instructions to reproduce the behavior:
- Create a piece-type with the given file, in the
module/presentation
folder :
module.exports = {
extend: '@apostrophecms/piece-type',
options: {
label: 'Présentation',
pluralLabel: 'Présentations',
publicApiProjection: {
title: 1,
body: 1,
}
},
fields: {
add: {
title: {
label: 'Titre de la sous-section de présentation',
type: 'string',
required: true
},
body: {
label: 'Corps de la présentation',
type: 'area',
options: {
widgets: {
'@apostrophecms/rich-text': {
toolbar: ['styles', 'bold', 'italic'],
styles: [
{
tag: 'p',
label: 'Paragraph (P)'
},
{
tag: 'h3',
label: 'Heading 3 (H3)'
}
]
}
}
},
required: true
},
},
group: {
homePresentationFields: {
label: 'Section Présentation',
fields: ['title', 'body']
}
}
}
};
- Run the apostrophe server with
npm run dev
- Make an API call to
http://localhost:3001/api/v1/homePresentation
- See the warning in the console
Expected behavior
There should not be warning in this case.
Details
Version of Node.js: Node v16.13.2. but reproduced on 12 too.
Server Operating System: Reproduced on Windows, Linux, inside a Docker.
Workaround
Adding type :1
to publicApiProjection
makes the warning disapear.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
punkave - Bountysource
The module types are related and the properties have identical keys, but they have ... and flag a missing type as a probable...
Read more >Type 'Document<any, any, any>' is missing the following ...
Argument of type 'ClientSession' is not assignable to parameter of type 'Callback<Document<any, any, any>>'. 46 await newAccount.
Read more >Authentication - Apostrophe 3 Documentation
All piece types in Apostrophe have a corresponding REST API. By default, this API is only available to authenticated users for security reasons....
Read more >537776 - Add flag to disable "Google API keys are missing" bar
This can currently be disabled by setting a "test type" when launching the browser, but doing so could interfere with the behavior of...
Read more >Apos3: document the need to include 'type' in the ... - IssueHint
Apos3 : document the need to include 'type' in the publicApiProjection and flag a missing type as a probable missing projection property.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since Apostrophe requires it is there a reason we wouldn’t ensure that it’s there regardless of the option? I’m not sure why we’d require developers using the public api projection option to know about a core code requirement.
Thanks Miro, can we move that to a separate ticket? This issue was more about Apostrophe helping to define better projections automatically.
On Thu, Jan 27, 2022 at 9:49 AM Miro Yovchev @.***> wrote:
–
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his