Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Added missing checkbox fields, added missing query parameters #2

Merged
merged 4 commits into from
Apr 22, 2023
Merged

[BUGFIX] Added missing checkbox fields, added missing query parameters #2

merged 4 commits into from
Apr 22, 2023

Conversation

barthy-koeln
Copy link
Contributor

Hi again,

This PR contains a change to add checkbox fields as booleans to the schema.

I've also added the base REST query parameters, as described in the payload documentation.

May I ask what your plans are for this repository?
I'm trying to gauge how much effort I should put into the current code base vs. writing or refactoring my own, if anything else comes up.

If you prefer discussing this separately from this PR, feel free to add me on Discord barthy.koeln#2946.
Sorry if I seem pushy, I'm just working on a Payload + Astro project right now :)

Barthy

Copy link
Owner

@janbuchar janbuchar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super awesome, thanks!

Comment on lines +48 to +49
{ in: 'query', name: 'locale', schema: { type: 'string' } },
{ in: 'query', name: 'fallback-locale', schema: { type: 'string' } },
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that available locales could (and eventually should) be extracted from the Payload config. Then, we could expose them as {type: 'string', enum: ['en', ...]}. If you just need a quick patch now, please make an issue to track this. Or just a code TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I have a local setup for my project right now, so there's no hurry to release on NPM.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the chmod change is not intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not. I usually set git to ignore file modes. I will set it back to 644.

@janbuchar
Copy link
Owner

May I ask what your plans are for this repository? I'm trying to gauge how much effort I should put into the current code base vs. writing or refactoring my own, if anything else comes up.

Originally, I started it because there was no open source headless CMS with good OpenAPI support and PayloadCMS seemed like a cool project with a lot of momentum (well, it is exactly that).

I want to use the package for a couple of website projects, which will probably make me work on this package further. That will probably happen in two or three weeks, but no promises.

In general, my plans are outlined in the roadmap in the readme file. I understand it's very brief though. If you have some ideas or requests, feel free to open issues 🙂

If you prefer discussing this separately from this PR, feel free to add me on Discord barthy.koeln#2946. Sorry if I seem pushy, I'm just working on a Payload + Astro project right now :)

Not pushy at all! I appreciate the help 🙂

@barthy-koeln
Copy link
Contributor Author

no open source headless CMS with good OpenAPI support

Agreed, and your version outputs the cleanest so far. Not much bloat, readable names, yay.

ideas or requests

I think the current code base needs some clean-up and restructuring to make further development easier.
There are two main pain points for me:

  • Split src/openapiSpec.ts into smaller modules
    • string manipulation functions
    • schema name functions
    • schema generator functions
  • Enforce a code style and best practices
    • indexer access vs. dot-notation
    • enforce multi-line objects

I'd be happy to code a suggestion if you're available for reviews.

@janbuchar
Copy link
Owner

Agreed, and your version outputs the cleanest so far. Not much bloat, readable names, yay.

I'm excited to hear that!

I'd be happy to code a suggestion if you're available for reviews.

Sure!

  • Split src/openapiSpec.ts into smaller modules

    • string manipulation functions
    • schema name functions
    • schema generator functions

Yeah, the transition from proof-of-concept to a maintainable package is not 100% yet.

  • Enforce a code style and best practices

    • indexer access vs. dot-notation
    • enforce multi-line objects

I usually just run eslint --fix and prettier --write on the codebase and call it a day, but I understand that it's not the most welcoming way for community contributors.

Also, there is now https://github.com/payloadcms/eslint-config - it may be worth it to use it.

@barthy-koeln
Copy link
Contributor Author

Hi again, I'm unsure when or how I'll have the time to work more on this. I would submit another PR anyway.

Can we merge and release this one?

@janbuchar
Copy link
Owner

Hi again, I'm unsure when or how I'll have the time to work more on this. I would submit another PR anyway.

Can we merge and release this one?

Hi, done, merged, released. I may have some time to work on the plugin next weekend. If it actually happens, I'll take care of that enum as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants