Code Monkey home page Code Monkey logo

Comments (10)

jasoncouture avatar jasoncouture commented on May 18, 2024

Just a comment on this rather than opening a new issue:
the underlying HttpClient timeout should be exposed, there are numerous situations where it would be highly helpful to be able to change the default timeout of 100 seconds.

client.RequestTimeout or configuration.RequestTimeout are a few suggestions.

from docker.dotnet.

jterry75 avatar jterry75 commented on May 18, 2024

@jasoncouture - Actually these arent the same type of "timeout" issue. Can you open a new issue for this so we can track it independently?

from docker.dotnet.

jasoncouture avatar jasoncouture commented on May 18, 2024

@jterry75 Sorry for the late response, Sure thing.

from docker.dotnet.

orthros avatar orthros commented on May 18, 2024

I just started looking at this this morning.
In addition to specgen getting updated with the custom type mapping, I'm assuming we should have the custom Json Serialization attribute mapped there as well?

from docker.dotnet.

orthros avatar orthros commented on May 18, 2024

So I've got a rough draft of this working, though it is untested.

specgen is now outputting certain types to TimeSpan? and you can specify on a per-property basis custom Attributes to decorate the property with.

On the json serialization of TimeSpan attributes: would it be better to decorate the Property with the "standard" [JsonConvert(Type converterType)] style, or to put in a IContractResolver and custom Attributes on the Properties to denote what should be serialized to/from seconds/nanoseconds?

I have it working both ways, but prefer the custom attributes path to help keep the consuming code clean.

from docker.dotnet.

jasoncouture avatar jasoncouture commented on May 18, 2024

@orthros,
Just my $0.02, I think the attribute is the better choice, because if we ever needed to change the contract resolver for something else it would be a headache.

from docker.dotnet.

orthros avatar orthros commented on May 18, 2024

@jasoncouture thanks for the feedback! In my PR (#205 ), I wound up going with a single attribute that you can decorate with a Seconds or Nanoseconds enumeration like so

[DataMember(Name = "Timeout", EmitDefaultValue = false)]
[TimeSpanSerialization(SerializationTarget.Nanoseconds)]
public TimeSpan Timeout { get; set; }

which then gets intercepted in the ContractResolver.

I wanted to avoid coupling the contract too closely with the serializer, and in his initial description @jterry75 mentioned introducing an Attribute, which I interpreted to be "custom" attribute 😄

I do see your point though; messing with the ContractResolver can be opaque at times.

'twould be a quick fix to refactor the code to use the [JsonConvert(SecondsConverter)] instead of the custom attributes if ya'll would rather do it that way.

from docker.dotnet.

orthros avatar orthros commented on May 18, 2024

I just filed another pull request that uses the builtin [JsonConvert] attributes and adds a small enhancement to specgen.

from docker.dotnet.

jterry75 avatar jterry75 commented on May 18, 2024

@orthros - This is completed yes? Can we close?

from docker.dotnet.

orthros avatar orthros commented on May 18, 2024

Yes it is. Thank you!

from docker.dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.