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.

Since enum support is available in api-doc-parser, an enum support could be added to InputGuesser. It will dynamically generate a SelectInput with restricted choices.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
alanpoulaincommented, Sep 30, 2022

So you mean to implement enum SelectInput guessing despite of which dataProvider is used and only for now it will only work only for OpenAPI, without assuming that we will now have both hydra features (schemaAnalyzer) and enum guessed, am I correct?

Yes you shouldn’t know which data provider is used anyway: everything needs to be abstracted.

0reactions
PawelSuwinskicommented, Sep 30, 2022

It’s OK if we don’t have support for enum in Hydra yet. The api-doc-parser library is abstracting it anyway: you don’t need to know if Hydra or OpenAPI is used. Also this admin can be used with OpenAPI only: https://api-platform.com/docs/admin/openapi/.

So you mean to implement enum SelectInput guessing despite of which dataProvider is used and only for now it will only work only for OpenAPI, without assuming that we will now have both hydra features (schemaAnalyzer) and enum guessed, am I correct?

And if you are using API Platform 2.7, there is already an enum support for Choice constraint: https://github.com/api-platform/core/blob/8108899dc986b2c6dd4b905151a7e70229ff34d0/src/Symfony/Validator/Metadata/Property/Restriction/PropertySchemaChoiceRestriction.php#L47-L51

Nope, 2.6 from previous Api Platform Distrubution 😉, I will upgrade and check it out, thanks for pointing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

enum — Support for enumerations — Python 3.11.1 ...
enum — Support for enumerations¶ · The class Color is an enumeration (or enum) · The attributes Color.RED , Color.GREEN , etc., are...
Read more >
Handbook - Enums - TypeScript
Enums allow a developer to define a set of named constants. Using enums can make it easier to document intent, or create a...
Read more >
Enumeration types - C# reference - Microsoft Learn
An enumeration type (or enum type) is a value type defined by a set of named constants of the underlying integral numeric type....
Read more >
Enum Types - Java™ Tutorials
An enum type is a special data type that enables for a variable to be a set of predefined constants. The variable must...
Read more >
Enumeration declaration - cppreference.com
Language support library ... Concurrency support library (C++11) ... 3) Opaque enum declaration: defines the enumeration type but not its ...
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