question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apos3: document the need to include 'type' in the publicApiProjection and flag a missing type as a probable missing projection property.

See original GitHub issue

To Reproduce

Step by step instructions to reproduce the behavior:

  1. 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']
      }
    }
  }
};

  1. Run the apostrophe server with npm run dev
  2. Make an API call to http://localhost:3001/api/v1/homePresentation
  3. See the warning in the console

image

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:open
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
abeacommented, Jan 18, 2022

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.

0reactions
boutellcommented, Jan 27, 2022

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:

@boutell https://github.com/boutell https://github.com/myovchev/apos-issue-3626 Ccreate an article, assign a tag, create and navigate to an article page type, click the tag, logout and look at the console logs.

— Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe/issues/3626#issuecomment-1023287683, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27OEOIY7ZRL7US4BR7LUYFLOBANCNFSM5MHT5VTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found