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

MethodAttribute not compiling in C# #966

Closed
V0d01ey opened this Issue Jun 19, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@V0d01ey

V0d01ey commented Jun 19, 2018

This is the example from documentation:

  • The attribute [Method("GET", "POST", ...)] on a class indicates which methods are accepted by this endpoint. Without this attribute, all methods are accepted.
	[Method("POST")]
	class PostArticle
	{
		int id;
	}

	SiteletBuilder().With<PostArticle>(/* ... */)

	// Accepted Request:    POST /article/12
	// Parsed Endpoint:     new PostArticle { id = 12 }
	// Returned Content:    (determined by .With())

But this example does not compile and gives the error:
Error CS0592 Attribute 'Method' is not valid on this declaration type. It is only valid on 'property, indexer' declarations.

BTW, the Accepted Request seems like having a mistake in docs.

@Jand42

This comment has been minimized.

Member

Jand42 commented Jun 19, 2018

Hi, thanks for the report.

Workaround: use [EndPoint("POST /")].

And indeed, the docs should have [Method("POST"), EndPoint("article/{id}")] there, fixing that too.

@Jand42 Jand42 self-assigned this Jun 20, 2018

Tarmil added a commit that referenced this issue Jun 26, 2018

@Tarmil Tarmil closed this Jun 26, 2018

@Tarmil Tarmil added the 4.3.0.274 label Jun 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment