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.

Are people seriously using this in production code?

See original GitHub issue

I don’t mean to be mean or disrespectful, but looking at the examples such as:

// Add these three attribute classes below
[OpenApiOperation(operationId: "greeting", tags: new[] { "greeting" }, Summary = "Greetings", Description = "This shows a welcome message.", Visibility = OpenApiVisibilityType.Important)]
[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiParameter("name", Type = typeof(string), In = ParameterLocation.Query, Visibility = OpenApiVisibilityType.Important)]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Greeting), Summary = "The response", Description = "This returns the response")]

public static async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Function, "get", Route = "greetings")] HttpRequestData req,
    FunctionContext executionContext)

Besides being a hard to read these are horrible to maintain. In previous versions when one could use swagger the documentation was made from what was actually in the code. With the above everything from the request parameters to the response data is in attributes. How long is it going to take before one of those is out of sync with the actual request parameters or response types.

I mean this might be fine for a hello world or some simple one developer site with few requests… But for a normal sized site with multiple developers and 100s or more different methods being exposed… This will just be one big mess.

I tried to see if there is some type of roadmap where auto generation of the specifications is in the future (which I dearly hope) but I could not find anything about that.

… or am I missing some big point here which makes this all very useful?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:9
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

jackbatznercommented, May 6, 2022

Let’s duscuss further. I’m also interested in this type of “linting” process. I don’t think it’s possible during the compile time, but it may be possible during the runtime (startup time).

This could be done via a Roslyn Analyzer. I think the real answer is that it’s hard to dive deep in code and truly understand wrapped responses.

justinyoocommented, Feb 14, 2022

Let’s duscuss further. I’m also interested in this type of “linting” process. I don’t think it’s possible during the compile time, but it may be possible during the runtime (startup time).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it normal for production code to be this confusing?
In my experience most production code is written badly unless you're in a place that really cares about the code.
Read more >
NEVER Write This Line Of Code In Production. Seriously
In this video I will show how a simple line of code can bring your entire application down ... SELECT * FROM table...
Read more >
Why (almost) all production code is garbage
The dirty secret of our industry is that almost all production code is garbage. The reason is complexity and over engineering, combined with ......
Read more >
What does production code mean?
Production code means that it runs on production servers so in the ideal world that should be the best version known to the...
Read more >
Is it typical for companies to not allow comments in ...
It is very unusual. I can think of reasons why, but first, why is self descriptive code considered best practice? * Comments and...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found